Chrome doesn't delete session cookies
P粉546179835
2023-08-16 20:26:24
<p>I'm trying to set a session cookie in javascript, like this: </p>
<pre class="brush:php;toolbar:false;">document.cookie = 'name=alex; path=/'</pre>
<p>But even if I quit the browser and start it again, Chrome won't delete it. </p>
<p> I checked in Firefox and Opera and both work as expected - they delete the session cookie when the browser exits. </p>
<p>Did Chrome just ignore the expiration rule? </p>
<p>I checked in multiple operating systems and found that session cookies are deleted in Chrome on Windows XP and Ubuntu, but not on Mac OSX Lion. </p>
I just ran into the same problem, a cookie was set to expire "at the end of the browsing session".
Unfortunately, it didn't expire, so I made some adjustments in my browser's settings.
It turns out that the ability to remember open tabs when the browser is closed is the source of the problem. (This feature is called "On startup" - "Continue where you were" on current versions of Chrome).
This problem also occurs in Opera and Firefox.
This may be caused by setting Chrome to continue where you left off.
Further reading