Delete the same cookie in different domains

In the past, we set our cookies without the "domain" option (using the cookie plugin ), for example:

$.cookie("blah", "1", {
    expires: 365,
    path: "/"
});

Now we install it like this:

$.cookie("blah", "1", {
    expires: 365,
    path: "/",
    domain: ".site.com"
});

However, the problem is that there are two cookies with the same name as for users who already have an old cookie on the page.

As a solution, when I set a new cookie, I do:

$.cookie("blah", null, {
    path: "/"
});

Which should delete the cookie without the "domain" option. Otherwise, when reading the cookie, it may give me the old value, as there may be 2 with the same name.

, ? Firefox, , , cookie, , , , , , IE6 ( )?

!

+3
1

:) , .

+1

All Articles