Why is sessionStorage not clear when closing browser or tab like chrome?

Copper Contributor

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,

0 Replies