files/en-us/web/api/storageaccesshandle/index.md
{{APIRef("Storage Access API")}}
The StorageAccessHandle interface represents access to unpartitioned state granted by a call to {{domxref("Document.requestStorageAccess()")}}.
document.requestStorageAccess({ localStorage: true }).then(
(handle) => {
console.log("localStorage access granted");
handle.localStorage.setItem("foo", "bar");
},
() => {
console.log("localStorage access denied");
},
);
[!NOTE] See Using the Storage Access API for a more complete example.
{{Specifications}}
{{Compat}}