Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why cookies dont expire after closing browser?

In books and tutorials related with Web-programming written that cookies expire when user close browser. So I cant understand why after closing browser(Opera) I can see the list of my cookies in "Parameters" window. And how sites (for example Facebook) identifier users after closing browser (session cookies must expire according to books and tutorials)?

like image 372
WelcomeTo Avatar asked Jan 17 '12 12:01

WelcomeTo


People also ask

Do cookies go away when browser closed?

By default, the cookie is destroyed when the current browser window is closed, but it can be made to persist for a length of time after the page is closed. Some cookies are 'session cookies', which means they only exist when your browser is open and are automatically deleted when you close your browser or quit the app.

Does session expire on closing browser?

Nothing. Session will not expire when uses closes the browser. As http is stateless, the server is not seeing what happens on client side.

How do cookies expire at end of session?

To set a cookie so it expires at the end of the browsing session, simply OMIT the expiration parameter altogether.


1 Answers

Cookies are of two different types:

  • session cookies, held in memory, and which expire once the browser exits
  • persistent cookies, which have a time-to-live, are persisted on disk, and are sent by the browser until their time-to-live has elapsed.

Read http://en.wikipedia.org/wiki/HTTP_cookie

like image 107
JB Nizet Avatar answered Sep 21 '22 06:09

JB Nizet