Jun 10 2022 09:00 PM - edited Jun 10 2022 09:04 PM
sessionStorage is supposed to be cleared when someone close browser, but it seems not working that way.
how to reproduce:
1. open browser new tab, goto https://www.microsoft.com/ ;
2. open devtools and set sessionStorage
sessionStorage.setItem('mykey', 'somevalue')
3. close browser and reopen, in my browser preferences, it will open last opened tabs
4. open devtools and check sessionStorage , and you'll see the value still exists.
sessionStorage.getItem('mykey')
some steps for chrome, and chrome sessionStorage is auto clear. Is there something wrong? or this is by design?
by the way, if you close tab instead of close entire browser, and undo tab close right after that, the sessionStorage is keep without clear, which is user-friendly and is consistent between msedge and chrome,