存在兩種類型的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

不設(shè)置過期時(shí)間,則表示這個(gè)cookie生命周期為瀏覽器會(huì)話期間,只要關(guān)閉瀏覽器窗口,cookie就消失了。這種生命期為瀏覽會(huì)話期的cookie被稱為會(huì)話cookie。會(huì)話cookie一般不保存在硬盤上而是保存在內(nèi)存里。

 

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

設(shè)置了過期時(shí)間,瀏覽器就會(huì)把cookie保存到硬盤上,關(guān)閉后再次打開瀏覽器,這些cookie依然有效直到超過設(shè)定的過期時(shí)間。

存儲(chǔ)在硬盤上的cookie可以在不同的瀏覽器進(jìn)程間共享,比如兩個(gè)IE窗口。而對于保存在內(nèi)存的cookie,不同的瀏覽器有不同的處理方式。