4 ms·
I would agree that Session storage is an ideal way for handling your session token if it wasnt for the fact that its only visible in a current window/tab. I do
by vladgur 10y ago
I would agree that Session storage is an ideal way for handling your session token if it wasnt for the fact that its only visible in a current window/tab.
I do want my users to be able to keep their session across tabs and not be forced to sign in again and as far as I know the only way to do this is to use cookie storage
Does anyone have a strategy use one of Web Storage APIs AND keep your session across tabs/windows?
- TheCoelacanth 10y agoUse localStorage instead of sessionStorage?
- vladgur 10y agoI was going to reply that localStorage persists even when entire browser is closed, whereas cookies do not, but i cant find the docs to confirm it. One use case would be somebody logging into a sensitive site from a public computer and expecting the session to end when the browser is closed.
- slykat 10y agoThe distinction you are making doesn't exist. localStorage and cookies both persist after the browser is closed so if you want that use case you won't get it from either.
- yxlx 10y agoMaybe they were thinking of the options most browsers have to clear selected private data on exit. In that case, though, it's still possible to clear both localStorage and cookies I am sure. Maybe parent commenter currently has the options set so that cookies are cleared but localStorage is not and that's why they thought that this is the way it always is.