DOM Window.sessionStorage Property
The sessionStorage property gives access to storage that keeps string data only for the current browser tab, clearing it when the tab closes.
Description
The sessionStorage property works like localStorage, but data is scoped to the current tab and is cleared when the tab is closed. It survives reloads and navigation within the tab, which makes it useful for things like the state of a multi-step form. Each tab has its own separate session storage.
Opening a page in a new tab, such as with "Open link in new tab", creates a fresh session storage, while duplicating a tab copies the existing one into the new tab. Data is cleared when the tab or window is closed, but survives a page reload and back/forward navigation.
Like localStorage, it only stores strings, is limited to a few megabytes, and is separate for each origin. Access can throw in sandboxed iframes, so wrap calls in try...catch where that's possible.
Syntax
sessionStorage
window.sessionStorageValue
A Storage object whose data lasts only as long as the browser tab.
Example
Browser Support
The following information will show you the current browser support for the Window.sessionStorage property. Hover over a browser icon to see the version that first introduced support for this property.
Desktop





Tablets & Mobile





