jsp cookie 漫谈

本文介绍了两种主要类型的Cookie:会话Cookie和持久Cookie。会话Cookie仅在浏览器会话期间存在,关闭浏览器后即消失;而持久Cookie则会保留在用户的硬盘上,直至过期或被手动删除。文中还详细讨论了不同浏览器对于Cookie的处理方式。

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

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

Persistent cookies - these remain on your hard drive until you erase them or they expire. How long a cookie remains on your browser depends on how long the visited website has programmed the cookie to last

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

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

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

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值