StorageAccessHandle: indexedDB 屬性

可用性有限

此特性不是基線特性,因為它在一些最廣泛使用的瀏覽器中不起作用。

StorageAccessHandle 介面的 indexedDB 屬性返回一個未分割槽的 IDBFactory 物件(如果訪問被授予),否則丟擲 SecurityError DOMException

一個 IDBFactory 物件。

示例

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

注意:有關更完整的示例,請參閱使用 Storage Access API

規範

規範
將儲存訪問API(SAA)擴充套件到非Cookie儲存
# dom-storageaccesshandle-indexeddb

瀏覽器相容性

另見