Favorites

DOM Window.sessionStorage Property

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Window.sessionStorage
DOM Window PropertyThis property is supported by all modern browsers.
Updated 28th November 2026

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.sessionStorage

Value

A Storage object whose data lasts only as long as the browser tab.

Example

try {
  sessionStorage.setItem('step', '2');
  console.log('Current step:', sessionStorage.getItem('step'));
} catch (e) {
  console.log('sessionStorage is not available here');
}

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.

This property is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee