简体   繁体   中英

How to destroy cookies on page refresh

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??

May be you could remove cookies on page unload.

For example, with jQuery:

$(window).unload(function() {
  //Destroy cookies here
});

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM