web api interface
StorageAccessHandle
The StorageAccessHandle interface represents access to unpartitioned state granted by a call to requestStorageAccess().
Instance properties
sessionStorageRead only- : Returns an unpartitioned session
Storageobject if access was granted.
- : Returns an unpartitioned session
localStorageRead only- : Returns an unpartitioned local
Storageobject if access was granted.
- : Returns an unpartitioned local
indexedDBRead only- : Returns an unpartitioned
IDBFactoryobject if access was granted.
- : Returns an unpartitioned
locksRead only- : Returns an unpartitioned
LockManagerobject if access was granted.
- : Returns an unpartitioned
cachesRead only- : Returns an unpartitioned
CacheStorageobject if access was granted.
- : Returns an unpartitioned
Instance methods
getDirectory()- : Returns a
Promisethat fulfills with an unpartitionedFileSystemDirectoryHandleobject if access was granted, and rejects otherwise.
- : Returns a
estimate()- : Returns a
Promisethat fulfills with an unpartitionedStorageEstimateobject if access was granted, and rejects otherwise.
- : Returns a
createObjectURL()- : Returns a string representing the unpartitioned blob storage url created if access was granted, and throws otherwise.
revokeObjectURL()- : Revokes the unpartitioned blob storage url passed in if access was granted, and throws otherwise.
BroadcastChannel()- : Returns the unpartitioned
BroadcastChannelcreated if access was granted, and throws otherwise.
- : Returns the unpartitioned
SharedWorker()- : Returns the unpartitioned
SharedWorkercreated if access was granted, and throws otherwise.
- : Returns the unpartitioned
Example
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
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.