StorageAccessHandle
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
The StorageAccessHandle interface represents access to unpartitioned state granted by a call to Document.requestStorageAccess().
Instance properties
StorageAccessHandle.sessionStorageRead only-
Returns an unpartitioned session
Storageobject if access was granted. StorageAccessHandle.localStorageRead only-
Returns an unpartitioned local
Storageobject if access was granted. StorageAccessHandle.indexedDBRead only-
Returns an unpartitioned
IDBFactoryobject if access was granted. StorageAccessHandle.locksRead only-
Returns an unpartitioned
LockManagerobject if access was granted. StorageAccessHandle.cachesRead only-
Returns an unpartitioned
CacheStorageobject if access was granted.
Instance methods
StorageAccessHandle.getDirectory()-
Returns a
Promisethat fulfills with an unpartitionedFileSystemDirectoryHandleobject if access was granted, and rejects otherwise. StorageAccessHandle.estimate()-
Returns a
Promisethat fulfills with an unpartitionedStorageEstimateobject if access was granted, and rejects otherwise. StorageAccessHandle.createObjectURL()-
Returns a string representing the unpartitioned blob storage url created if access was granted, and throws otherwise.
StorageAccessHandle.revokeObjectURL()-
Revokes the unpartitioned blob storage url passed in if access was granted, and throws otherwise.
StorageAccessHandle.BroadcastChannel()-
Returns the unpartitioned
BroadcastChannelcreated if access was granted, and throws otherwise. -
Returns the unpartitioned
SharedWorkercreated if access was granted, and throws otherwise.
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
| Specification |
|---|
| Extending Storage Access API (SAA) to non-cookie storage> # storageaccesshandle> |
Browser compatibility
Loading…