0

I have read that:

The session storage uses the sessionStorage object to store data on a temporary basis, for a single window (or tab). The data disappears when session ends i.e. when the user closes that window (or tab)

I have 2 html files stored locally. I populate a session Storage item when File1 is loaded. Without closing the tab I try to open File2 (using browser address bar). It seems I cannot retrieve the same session Storage item now.

Is this supposed to work like this? When I move back to the File1 html page, I can still see the value.

Why does this happen?

4
  • is the same domain¿? Commented Oct 17, 2017 at 10:54
  • Locally as in file:///…? I’m surprised that that even works within a single filename. Different local files have to be isolated, anyway. Commented Oct 17, 2017 at 10:55
  • There's no recommended to have sessions across tabs. Look here Commented Oct 17, 2017 at 11:02
  • use a static web server such as 'http-server' of nodejs to serve static files. Don't use file:// Commented Oct 17, 2017 at 11:08

1 Answer 1

1

If you are using, chrome browser you can open developer to check weather your session storage has saved (also available on other browser) , and also can check weather have share among the tab.

enter image description here

As my experience, session storage is able to share among the tab, but not recommenced, data may lose once browser crash.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.