Firefox Tomorrow

web api instance method

SharedStorage: clear() method

View on MDN ↗

The clear() method of the SharedStorage interface clears the current origin’s shared storage, removing all data from it.

Syntax

clear()

Parameters

None.

Return value

A Promise that fulfills with undefined.

Exceptions

[!NOTE] In the case of WindowSharedStorage, if the clear() operation doesn’t successfully write to the database for a reason other than shared storage not being available, no error is thrown — the operation still fulfills with undefined.

Examples

window.sharedStorage.clear().then(() => console.log("Shared storage cleared"));

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also