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 |
浏览器兼容性
加载中…