Skip to content Skip to sidebar Skip to footer

Deleting A Cookie In Javascript Does Not Work Consistently

I have the following code to set, get, and delete cookies: function set_cookie( name, value, expires, path, domain, secure ) { var today = new Date(); today.setTime( today.getT

Solution 1:

I think a deleted cookie will only be de-actived after you have navigated away from the current page.

Insert the code below right after you delete the cookie;

location.href="bringmeback.html";

bringmeback.html (redirect to current page);

location.href="currentpage.html";

You can use this code to test if your cookie was completely deleted.

Post a Comment for "Deleting A Cookie In Javascript Does Not Work Consistently"