Back to Content

StorageAccessHandle: indexedDB property

files/en-us/web/api/storageaccesshandle/indexeddb/index.md

latest912 B
Original Source

{{APIRef("Storage Access API")}}

The indexedDB property of the {{domxref("StorageAccessHandle")}} interface returns an unpartitioned {{domxref("IDBFactory")}} object if access was granted, and throws a SecurityError {{DOMxRef("DOMException")}} otherwise.

Value

An {{domxref("IDBFactory")}} object.

Examples

js
document.requestStorageAccess({ indexedDB: true }).then(
  (handle) => {
    console.log("indexedDB access granted");
    await handle.indexedDB.deleteDatabase("foo");
  },
  () => {
    console.log("indexedDB access denied");
  },
);

[!NOTE] See Using the Storage Access API for a more complete example.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also