【发布时间】:2011-02-02 10:59:56
【问题描述】:
我正在开发一个删除会话 cookie 的功能
这里是源代码:
<script language="javascript">
window.onload = function ()
{
/* $.cookie('!lithiumSSO:tomtom.stage', null);
$.cookie('LiSESSIONID', null);*/
delete_cookie('LiSESSIONID');
delete_cookie('!lithiumSSO:tomtom.stage');
};
function delete_cookie ( cookie_name )
{
var cookie_date = new Date ( ); // current date & time
cookie_date.setTime ( cookie_date.getTime() - 1 );
document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
alert('name:' +cookie_name);
jQuery.cookie('LiSESSIONID', null); //Try to using jQuery
}
</script>
我可以设置弹出窗口显示name:LiSESSIONID=; expires=Wed, 02 Feb 2011 10:56:52 GMT。比这晚了一个小时。但是,当我使用 firecookies 时,我看到这个 cookie 仍然存在:
LiSESSIONID
7A10E3453B01DDFF934AC7AF71EAFEC3
forums.lithiumstage.tomtom.com
43 B
/
Session
HttpOnly
有人知道为什么我不能杀死 cookie 吗?即使我加载函数,jQuery 函数状态也显示未定义。
【问题讨论】:
标签: jquery jquery-events