StorageAccessHandle: caches 屬性
StorageAccessHandle 介面的 caches 屬性返回一個未分割槽的 CacheStorage 物件(如果訪問被授予),否則丟擲 SecurityError DOMException 異常。
值
一個 CacheStorage 物件。
示例
js
document.requestStorageAccess({ caches: true }).then(
(handle) => {
console.log("caches access granted");
const cache = await handle.caches.open("foo");
await cache.add("/");
},
() => {
console.log("caches access denied");
},
);
注意:有關更完整的示例,請參閱使用 Storage Access API。
規範
| 規範 |
|---|
| 將儲存訪問API(SAA)擴充套件到非Cookie儲存 # dom-storageaccesshandle-caches |
瀏覽器相容性
載入中…