Skip to Content
Platform.Ontology

Cookie Store API

Reads and changes cookies asynchronously and gets change events, including in service workers.

Works without askingThings a page can doStorageWeb browsersWhile you use itAfter you leave the site

In one line

Can watch and change the site's own cookies, but not hidden ones or other sites' cookies

Reads and changes cookies asynchronously and gets change events, including in service workers.

A site can watch and edit its own cookies without parsing document.cookie. It sees only non-HttpOnly cookies for its own origin.

What it can and can't do

What the user does: Nothing. It happens when the site's script checks or sets a cookie

It can

  • List and change the site's own cookies that scripts may see
  • Get a notice when its own cookies change, including in a background script
  • Keep your sign in in step across tabs

It cannot

  • See other sites' cookies
  • See protected cookies marked HttpOnly
  • Work from outside the site's own address
  • Be sure to stop cookie syncing, which you stop by clearing cookies or blocking trackers

Browser support

BrowserStatusFirst versionReleasedNote
ChromeSupported872020-11-17None
EdgeSupported872020-11-19None
FirefoxSupported1402025-06-24None
SafariSupported18.42025-03-31None
Safari on iPhoneSupported18.42025-03-31All iOS browsers use WebKit
Chrome on AndroidSupported872020-11-17None
Samsung InternetSupported14.02021-04-17None

How a site asks for it

APIcookieStore.get(), getAll(), set(), delete(); cookiechange event
Browser compat keysapi.CookieStore
api.CookieStoreManager
How access is grantednone
What the user seesNone (no browser prompt)
Needs a secure context (HTTPS)Yes
Needs a user gestureNo
Activationnone
How long it lastsSame as the cookie lifetime
How to take it backNothing to revoke (no permission is stored)
Inside an iframeSame-origin and secure contexts only

Typical flow

  1. Call cookieStore.set({name, value})
  2. Cookie stored
  3. cookiechange event fires in other tabs and service workers

Data you get

Shape: none

No individual data fields. The signal is the access itself.

Technical limits

  • HTTPS only; cannot read HttpOnly cookies
  • Cookie size limit 4096 bytes for name plus value; about 180 cookies per domain in Chrome, 50 per domain in Firefox (older), 150 in Safari
  • Max Expires/Max-Age cap is 400 days in Chrome (Chrome 104)
  • Third-party contexts follow normal third-party cookie blocking and the Storage Access API
  • Support per MDN BCD: Chrome and Edge 87, Safari 18.4, Firefox 140

The story

What it is

A page can read and change cookies the modern way and hear about changes, even in background scripts.

For you

You never see it. Sites use it to remember your login and settings. If you clear cookies, the site will see the change.

For makers

Makers use it to manage login, consent choices and tracking IDs without blocking the page. Change events let them react when cookies are added or cleared. It works inside background scripts too.

Where you see it

TypeExampleApps
shoppingA store keeps your cart and login in cookies, and notices if they are cleared to rebuild your session.None named
adsAn ad script watches for cookie changes and re-creates its ID if you clear it.None named
analyticsAn analytics tool reads and writes its visitor ID cookie, and sends a new event when it changes.Google Analytics
gamesA browser game portal stores your sign in and settings in cookies, and syncs across tabs.None named
securityA bank page detects when its session cookie is removed and logs out the tab.None named
newsA news site stores your cookie consent choices and reads them in the background scripts.None named
videoA streaming site shares a login across tabs using cookie change events.Netflix

Risks

  • Tracking IDs
  • Hard to clear for good

What the platform says

Good uses and abuse

Legitimate uses

  • Session sync across tabs
  • Service worker session checks

Known abuse

  • Cookie syncing and ID resurrection
  • Persistent identifiers

Scores

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

History

  • 2020-11, Chrome 87: Cookie Store API ships
  • 2022-08, Chrome 104: Cookie Max-Age and Expires capped at 400 days
  • 2025-03, Safari 18.4: Cookie Store API ships in Safari
  • 2025-06, Firefox 140: Cookie Store API ships in Firefox

Sources

How well checked: Based on official documentation.

On this page