coderef

Shared storageLimited availability

The sharedStorage API stores data to a shared space where the data can then be processed without the ability to track users across the different sites they visit. A common use case is measuring the reach of third-party ads without using user-tracking cookies.

Not yet supported in all major browsers — check the table and provide a fallback.

Discouraged: Following the announcement that Chrome will maintain its current approach to third-party cookies, Chrome decided to withdraw certain Privacy Sandbox features including the shared storage.

Browser support

DesktopChrome
✕Not supportedup to 155
Current: 155
Edge
✕Not supportedup to 154
Current: 154
Firefox
✕Not supportedup to 157
Current: 157
Safari
✕Not supportedup to 27
Current: 27
MobileChrome Android
✕Not supportedup to 155
Current: 155
Firefox Android
✕Not supportedup to 157
Current: 157
Safari iOS
✕Not supportedup to 27
Current: 27

How to use

Not supported in Chrome, Edge, Firefox, Safari, Chrome Android, Firefox Android, Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: SharedStorage.

Feature detection

JS · check before using
if ("SharedStorage" in globalThis) {
  // SharedStorage is available
} else {
  // load a polyfill or use a fallback
}

Sub-features

Support for each part of the feature (19). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
HTMLIFrameElement.sharedStorageWritable126126✕✕126✕✕
HTMLImageElement.sharedStorageWritable126126✕✕126✕✕
SharedStorage126126✕✕126✕✕
SharedStorage.append126126✕✕126✕✕
SharedStorage.clear126126✕✕126✕✕
SharedStorage.createWorklet126126✕✕126✕✕
SharedStorage.delete126126✕✕126✕✕
SharedStorage.get✕✕✕✕✕✕✕
SharedStorage.run126126✕✕126✕✕
SharedStorage.selectURL126126✕✕126✕✕
SharedStorage.set126126✕✕126✕✕
SharedStorage.worklet126126✕✕126✕✕
SharedStorageWorklet126126✕✕126✕✕
SharedStorageWorklet.run126126✕✕126✕✕
SharedStorageWorklet.selectURL126126✕✕126✕✕
SharedStorageWorkletGlobalScope126126✕✕126✕✕
SharedStorageWorkletGlobalScope.register126126✕✕126✕✕
SharedStorageWorkletGlobalScope.sharedStorage126126✕✕126✕✕
Window.sharedStorage126126✕✕126✕✕