files/en-us/web/api/sharedstorage/delete/index.md
{{APIRef("Shared Storage API")}}{{deprecated_header}}
The delete() method of the {{domxref("SharedStorage")}} interface deletes an existing key-value pair from the current origin's shared storage.
delete(key)
key
A {{jsxref("Promise")}} that fulfills with undefined.
Promise rejects with a {{jsxref("TypeError")}} if:
key exceeds the browser-defined maximum length.Promise rejects with a {{jsxref("TypeError")}} if:
[!NOTE] If the key-value pair doesn't exist in the shared storage, no error is thrown — the operation still fulfills with
undefined.
[!NOTE] In the case of {{domxref("WindowSharedStorage")}}, if the
delete()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 withundefined.
window.sharedStorage
.delete("ab-testing-group")
.then(() => console.log("Value deleted"));
{{Specifications}}
{{Compat}}