开发者

Cookie doesn't expire on IE6

开发者 https://www.devze.com 2023-02-14 15:53 出处:网络
I am running IE6 from 6.0.3790 (hosted on Citrix Server). In Logoff we have expired the cookie using curDate.setTime(curDate.getTime() - 24开发者_如何学JAVA * 60 * 60 * 1000);

I am running IE6 from 6.0.3790 (hosted on Citrix Server).

In Logoff we have expired the cookie using

curDate.setTime(curDate.getTime() - 24开发者_如何学JAVA * 60 * 60 * 1000);    
document.cookie = name + "=; expires=" + curDate.toGMTString() + "; path=/; domain=" + cookieDomain;

where name is the name of cookie.

Problem is with this browser the cookie never expr


Don't use relative date/times for the expiration value. It's safer to use an absolute one like expires=Thu, 01-Jan-1970 00:00:01 GMT;. You're depending on the client's clock to be reasonably accurate, which isn't always the case.

As well, the domain and path settings have to be identical to what they were went the cookie was originally set.

It's also best to set the cookie's value to something obvious, like "deleted", rather than a blank value (name=), in case the browser interprets the lack of a value as "nothing should be changed".

0

精彩评论

暂无评论...
验证码 换一张
取 消