StorageAccessHandle: thuộc tính indexedDB

Khả dụng hạn chế

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Thuộc tính indexedDB của giao diện StorageAccessHandle trả về một đối tượng IDBFactory không phân vùng nếu quyền truy cập được cấp, và ném ra SecurityError DOMException trong trường hợp khác.

Giá trị

Một đối tượng IDBFactory.

Ví dụ

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

Note: Xem Using the Storage Access API để biết ví dụ đầy đủ hơn.

Thông số kỹ thuật

Thông số kỹ thuật
Extending Storage Access API (SAA) to non-cookie storage
# dom-storageaccesshandle-indexeddb

Tương thích trình duyệt

Xem thêm