Skip to content

Destroy session as browser is closed. #1532

Closed Answered by TheBinaryGuy
dinogomez asked this question in Help
Discussion options

You must be logged in to vote

Yeah kinda, just store the cookie with no expiry or max age and it'll get destroyed when the browser is closed.

More info here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#define_the_lifetime_of_a_cookie

As the MDN article points out, the "browser" defines when a session ends, and if the browser supports session restoration, it might persist across restarts.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dinogomez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants