Skip to Content
Platform.Ontology

sessionStorage

A per tab store of up to about 5 MB that is cleared when the tab closes.

Works without askingFiles and storageIn sessionWeb browsersWhile you use it

In one line

Can keep up to about 5 MB of notes for this tab until you close it

A per tab store of up to about 5 MB that is cleared when the tab closes.

Used for checkout steps and form state, and for trackers that carry a 'session ID' inside one tab. Different tabs of one site do not share it, so it cannot follow the person across tabs. Copied into a tab opened by window.open.

What it can and can't do

What the user does: Nothing. It happens as you move through steps or forms in the tab.

It can

  • Remember form steps and choices while the tab is open
  • Keep them when you reload the page
  • Keep a separate set for each tab

It cannot

  • Share them with your other tabs
  • Keep them after you close the tab
  • Let other sites see them

Browser support

BrowserStatusFirst versionReleasedNote
ChromeSupported42010-01-25None
EdgeSupported122015-07-29None
FirefoxSupported22006-10-24None
SafariSupported42009-06-08None
Safari on iPhoneSupported3.22010-04-03None
Chrome on AndroidSupported182012-06-27None
Samsung InternetSupported1.02013-04-27None

How a site asks for it

APIwindow.sessionStorage.setItem(k, v)
Browser compat keysapi.Window.sessionStorage
How access is grantednone
What the user seesNone
Needs a secure context (HTTPS)No
Needs a user gestureNo
How long it lastsUntil the tab or window closes. Browsers may restore it after crash or tab restore
How to take it backClear site data, browser privacy settings
Inside an iframeNot listed

Data you get

What comes back: Key value strings
Shape: string
How often: any time

FieldTypeUnitRangePrecision
quotaintegerMiBabout 5 per originapproximate

Technical limits

  • About 5 MiB per origin per tab
  • Separate per tab even for the same origin
  • Cleared on tab close
  • Cloned (not shared) when a tab is duplicated

The story

What it is

A store of up to about 5 MB for one tab that is cleared when you close the tab.

For you

You never see it. It is why a form can hold what you typed while you click through the steps, and why a new tab starts fresh.

For makers

Makers use it for short lived state like multi step forms and temporary tokens. It is safer than long term storage, because it disappears with the tab. It is also used for session IDs in analytics.

Where you see it

TypeExampleApps
shoppingA checkout keeps your shipping choices while you move through the steps.None named
bankingA bank keeps a short lived token in the tab and loses it when you close it.None named
gamesA browser game keeps the current level in a tab but does not save it forever.None named
travelA booking site keeps your search and seat choices while you compare flights.None named
analyticsA site analytics script uses it to mark one visit as one session.Google Analytics
educationAn online test keeps your answers in the tab until you submit.None named

Risks

  • Lost on tab close
  • Readable by page scripts

What the platform says

Good uses and abuse

Legitimate uses

  • Multi step flows, scroll position

Known abuse

  • Per tab session IDs for analytics

Scores

ScoreValueMeaning
Sensitivity2 of 5How revealing the data is
Utility4 of 5How useful it is to honest apps
Friction0 of 5How much the user has to do
Fingerprint bits0Rough identifying entropy, when known

History

  • 2023-07, Chrome 115: Third party sessionStorage partitioned by top level site
  • localStorage. Can keep up to about 5 MB of text notes per site, until cleared

Sources

How well checked: Based on official documentation.

On this page