Hello I need to destroy javascript cookies on a page refresh. I need to set a new bunch of cookies on every page load which help me render the web page based on user options. Is there a method to destroy cookies on a page refresh??
A:
You need to detect the page refresh, have a look at:
Detecting Page Refreshes :: Using JavaScript on Client-Side
Once you know that, you should be able to delete the cookies.
Sarfraz
2010-07-29 17:09:20
tried this already!! does not help my situation!!
sai
2010-07-29 17:20:27
A:
May be you could remove cookies on page unload.
For example, with jQuery:
$(window).unload(function() {
//Destroy cookies here
});
cesarnicola
2010-07-29 17:10:06
of course! :) http://api.jquery.com/unload/ http://www.codetoad.com/javascript/miscellaneous/onunload_event.asp
cesarnicola
2010-07-29 17:35:08
hey but is this a page refresh?? this is when you navigate away from the page?
sai
2010-07-29 17:38:50