Soheil
Soheil

Reputation: 5354

How long session stays on browsers?

I tried my website on local host with Safary, chrome, firefox, and opera and appears that when I close the browser it remove the session too. But when I tried on Chrome, it still there. why is that so ?

Upvotes: 1

Views: 3978

Answers (2)

T0xicCode
T0xicCode

Reputation: 4941

Sessions are stored by default in cookies.

A cookie is a small value stored in the browser, and they always have an expiry date. If the expiry date is in the past, the cookie is destroyed immediately. If the cookie has an expiry date in the future, it is kept and used until that date, at which point it is destroyed. There is also a special "date" that can be used which tells the browser to consider the cookie valid as long as the browser is open. Typically the browser will destroy those cookies when you click the X to close the application.

Keep in mind that browsers can be configured to never delete cookies (even expired ones), to delete cookies every time the application is closed, even if the cookie is still valid, or even to not accept cookies at all.

Upvotes: 2

Zaar Hai
Zaar Hai

Reputation: 9869

Session is basically a cookie stored by your browser.

Cookie has an age. After they expire browsers usually discard them and/or servers disregard them.

There also special types of cookies that browsers are required to remove after they are closed.

Since your sessions disappears after closing Safary and Firefox, it looks like you have the second type of cookies. So, are you sure you've closed your Chrome browser? May be you have some window left in another virtual desktop or something...

Upvotes: 4

Related Questions