jsp cookie 漫谈

来源:互联网 发布:海南宇萱网络 编辑:程序博客网 时间:2024/05/16 15:02

Session cookies -these are temporary and are erased when you close your browser atthe end of your surfing session. The next time you visit thatparticular site it will not recognise you and will treat you as acompletely new visitor as there is nothing in your browser to letthe site know that you have visited before

不设置过期时间,则表示这个cookie生命周期为浏览器会话期间,只要关闭浏览器窗口,cookie就消失了。这种生命期为浏览会话期的cookie被称为会话cookie。会话cookie一般不保存在硬盘上而是保存在内存里。

Persistentcookies - these remain on your hard drive until you erasethem or they expire. How long a cookie remains on your browserdepends on how long the visited website has programmed the cookieto last

设置了过期时间,浏览器就会把cookie保存到硬盘上,关闭后再次打开浏览器,这些cookie依然有效直到超过设定的过期时间。

存储在硬盘上的cookie可以在不同的浏览器进程间共享,比如两个IE窗口。而对于保存在内存的cookie,不同的浏览器有不同的处理方式。

根据这种分法,IE会为每个浏览器进程会保存一份会话cookie,如是通过页面的在新窗口打开,会话cookie会传递给新的游览器进程。

如果把会话cookie持久化保存到本地后,其它IE浏览器窗口的会话cookie会失效,转而使用本地的持久cookie,这个在应用处理中需要注意

原创粉丝点击