How to destroy cookies on page refresh

别说谁变了你拦得住时间么 提交于 2019-12-07 06:55:00

问题


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


回答1:


May be you could remove cookies on page unload.

For example, with jQuery:

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



回答2:


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.



来源:https://stackoverflow.com/questions/3365178/how-to-destroy-cookies-on-page-refresh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!