Session storage data is accessible only during the lifetime of the current browser tab or window session. Specifically:
- The data stored in
sessionStorage
persists as long as the browser tab or window remains open, surviving page reloads and restores within that same session. - Once the tab or window is closed, the session ends and the data in
sessionStorage
is cleared and no longer accessible. - Opening the same page in a new tab or window creates a new, separate session with its own
sessionStorage
. - If the browser or tab is restored (e.g., using a "reopen closed tab" feature), the session storage data can be restored as well until the session finally ends.
- Unlike
localStorage
, which persists indefinitely until explicitly cleared,sessionStorage
is designed for temporary storage limited to the current browsing session context.
In summary, session storage is accessible only during the active browsing session of a single tab or window, and it is cleared when that session ends by closing the tab or window