在离开网页时移除Cookie [英] Remove cookie upon leaving the webpage

查看:194
本文介绍了在离开网页时移除Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法自动离开网络应用程序时删除所有Cookie?

Is there a way to delete ALL cookies upon leaving the web application automatically ?

知道他可以通过点击链接,关闭标签,点击主页按钮等。

knowing that he can leave the web page by clicking on a link, closing tab, clicking on home page button, etc.

推荐答案

如果你想在关闭窗口关闭cookie,cookie将保存在客户端的机器上您可以设置会话Cookie ,在会话关闭时自动失效。但是如果你想关闭关闭选项卡上的cookie,你可以使用关闭选项卡上的javascript事件,如window.onclose来删除所有的cookie。

The cookie would save in client's machine, if you want to close cookie on close window you can set a session cookie, will automatically expire when session closed. but if you want to close cookie on close tab you can use javascript event on close tab such as window.onclose to delete all cookies.

这篇关于在离开网页时移除Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆