经典论坛's Archiver

kkllchun 发表于 2008-8-28 21:14

document.cookie怎么设置成关闭浏览器消失

document.cookie="a=1;expires="+Date();也没用啊
就是不消失

erik168 发表于 2008-8-29 03:03

首先你要知道你想清空的cookie的key,否则你只有通过正则匹配出所有cookie

然后,在window.onunload事件中,清除cookie~

kkllchun 发表于 2008-8-29 07:20

能不能说的清楚些呢

asfman 发表于 2008-8-29 10:43

默认就是关闭游览器消失
Setting no expiration date on a cookie causes it to expire when the browser closes. If you set an expiration date in the future, the cookie is saved across browser sessions. If you set an expiration date in the past, the cookie is deleted. Use GMT format to specify the date.

页: [1]



Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.