如何删除会话Cookie? [英] How to Delete Session Cookie?
问题描述
如何通过javascript动态删除会话Cookie,而无需手动重新启动浏览器?
How to dynamically, via javascript, delete a session cookie, without manually restarting the browser?
我在浏览器内存中保留了会话cookie,
I read somewhere that session cookie is retained in browser memory and will be removed when the browser is closed.
// sessionFooCookie is session cookie
// this code does not delete the cookie while the browser is still on
jQuery.cookie('sessionFooCookie', null);
感谢。
更多信息:上面的代码片段是一个
JavaScript代码片段,使用jQuery
及其jQuery.cookie插件。
More Info: The code snippet above is a javascript code snippet, using jQuery and its jQuery.cookie plugin.
推荐答案
会话cookie只是一个没有到期日期的普通cookie。
A session cookie is just a normal cookie without an expiration date. Those are handled by the browser to be valid until the window is closed or program is quit.
但是如果cookie是一个 httpOnly $,那么这些都是由浏览器处理的,直到窗口关闭或程序退出。 c $ c> cookie(与
httpOnly $ c $) c> parameter
set),则不能从HTTP外部读取,更改或删除它。
But if the cookie is a httpOnly
cookie (a cookie with the httpOnly
parameter set), you cannot read, change or delete it from outside of the HTTP.
这篇关于如何删除会话Cookie?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!