web api instance property
StorageAccessHandle: localStorage property
The localStorage property of the StorageAccessHandle interface returns an unpartitioned local Storage object if access was granted, and throws a SecurityError DOMException otherwise.
Value
A Storage object.
Examples
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.