SharedStorage

Deprecated
To be removed

This feature is pending removal from browsers. Using it now may lead to broken functionality in future updates. 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.

Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.

The SharedStorage interface of the Shared Storage API represents the shared storage for a particular origin, defining methods to write data to the shared storage.

SharedStorage is the base class for:

Instance methods

append()

Appends a string to the value of an existing key-value pair in the current origin's shared storage.

clear()

Clears the current origin's shared storage, removing all data from it.

delete()

Deletes an existing key-value pair from the current origin's shared storage.

set()

Stores a new key-value pair in the current origin's shared storage or updates an existing one.

Examples

js
window.sharedStorage
  .set("ab-testing-group", "0")
  .then(() => console.log("Value saved to shared storage"));

Specifications

This feature does not appear to be defined in any specification.

Browser compatibility

See also