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