Shared storage locksLimited availability
The withLock option to set(), append(), delete(), clear(), and batchUpdate() methods of the sharedStorage API prevents duplicate reporting from cross-site race conditions.
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 shared storage locks.
Browser support
How to use
Not supported in Firefox, Safari, 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 — see the links below.
Feature detection
if ("SharedStorageAppendMethod" in globalThis) {
// SharedStorageAppendMethod is available
} else {
// load a polyfill or use a fallback
}Specification
Sub-features
Support for each part of the feature (10). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| SharedStorage.batchUpdate | 134 | 134 | ✕ | ✕ | 134 | ✕ | ✕ |
| SharedStorageAppendMethod | 134 | 134 | ✕ | ✕ | 134 | ✕ | ✕ |
| SharedStorageAppendMethod.SharedStorageAppendMethod | 134 | 134 | ✕ | ✕ | 134 | ✕ | ✕ |
| SharedStorageClearMethod | 134 | 134 | ✕ | ✕ | 134 | ✕ | ✕ |
| SharedStorageClearMethod.SharedStorageClearMethod | 134 | 134 | ✕ | ✕ | 134 | ✕ | ✕ |
| SharedStorageDeleteMethod | 134 | 134 | ✕ | ✕ | 134 | ✕ | ✕ |
| SharedStorageDeleteMethod.SharedStorageDeleteMethod | 134 | 134 | ✕ | ✕ | 134 | ✕ | ✕ |
| SharedStorageModifierMethod | 134 | 134 | ✕ | ✕ | 134 | ✕ | ✕ |
| SharedStorageSetMethod | 134 | 134 | ✕ | ✕ | 134 | ✕ | ✕ |
| SharedStorageSetMethod.SharedStorageSetMethod | 134 | 134 | ✕ | ✕ | 134 | ✕ | ✕ |