Shared storage
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. It is most useful when native HTML semantics or browser capabilities can replace custom implementation work.
Overview
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. It is most useful when native HTML semantics or browser capabilities can replace custom implementation work.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
SharedStorage Deprecated | 126 | 126 | | | 126 | |
sharedStorageWritable Deprecated | 126 | 126 | | | 126 | |
sharedStorageWritable Deprecated | 126 | 126 | | | 126 | |
append Deprecated The append() method of the SharedStorage interface appends a string to the value of an existing key-value pair in the current origin's shared storage. | 126 | 126 | | | 126 | |
clear Deprecated The clear() method of the SharedStorage interface clears the current origin's shared storage, removing all data from it. | 126 | 126 | | | 126 | |
createWorklet Deprecated | 126 | 126 | | | 126 | |
delete Deprecated The delete() method of the SharedStorage interface deletes an existing key-value pair from the current origin's shared storage. | 126 | 126 | | | 126 | |
get Deprecated | 126 | 126 | | | 126 | |
run Deprecated | 126 | 126 | | | 126 | |
selectURL Deprecated | 126 | 126 | | | 126 | |
set Deprecated The set() method of the SharedStorage interface either stores a new key-value pair in the current origin's shared storage or updates an existing one. | 126 | 126 | | | 126 | |
worklet Deprecated | 126 | 126 | | | 126 | |
SharedStorageWorklet Deprecated The SharedStorageWorklet interface of the Shared Storage API represents the shared storage worklet for the current origin. | 126 | 126 | | | 126 | |
run Deprecated | 126 | 126 | | | 126 | |
selectURL Deprecated | 126 | 126 | | | 126 | |
SharedStorageWorkletGlobalScope Deprecated The SharedStorageWorkletGlobalScope interface of the Shared Storage API represents the global scope of a SharedStorageWorklet module. | 126 | 126 | | | 126 | |
register Deprecated The register() method of the SharedStorageWorkletGlobalScope interface registers an SharedStorageOperation defined inside the current worklet module. | 126 | 126 | | | 126 | |
sharedStorage Deprecated The context read-only property of the SharedStorageWorkletGlobalScope interface contains a WorkletSharedStorage object instance, which represents the shared storage for a particular origin as exposed to a worklet context. | 126 | 126 | | | 126 | |
sharedStorage Deprecated The global read-only sharedStorage property returns the WindowSharedStorage object for the current origin. This is the main entry point for writing data to shared storage using the Shared Storage API. | 126 | 126 | | | 126 | |
Syntax
// Write data
await window.sharedStorage.set('ab-group', 'experiment');
// Readable only within the worklet
await window.sharedStorage.worklet.addModule('worklet.js');
await window.sharedStorage.run('operation'); Use cases
Strengthen integration
Use Shared storage when browser APIs need clearer security boundaries or more explicit capabilities.
Connect platform features
Apply Shared storage when your app benefits from deeper browser or device integration.
Cautions
- Test Shared storage in your target browsers and input environments before depending on it as a primary behavior.
- Provide a fallback path or acceptable degradation strategy when support is still limited.
Accessibility
- Make sure Shared storage supports the intended task without making the page harder to perceive, understand, or operate.
Related links
Powered by web-features