Storage Access API
[!NOTE] See SharedWorker.SharedWorker to understand usage.
Syntax
SharedWorker(url)
SharedWorker(url, name)
SharedWorker(url, options)
Parameters
url- : See SharedWorker.SharedWorker.
name- : See SharedWorker.SharedWorker.
options- : See SharedWorker.SharedWorker.
[!NOTE]
options.sameSiteCookiesonly supports the value "none", which is the default.
Return value
An unpartitioned SharedWorker object.
Exceptions
SecurityErrorDomException- : Thrown if access was not granted.
See SharedWorker.SharedWorker
Examples
document.requestStorageAccess({ SharedWorker: true }).then(
(handle) => {
console.log("SharedWorker access granted");
handle.SharedWorker(shared_worker_url);
},
() => {
console.log("SharedWorker access denied");
},
);
[!NOTE] See Using the Storage Access API for a more complete example.
Specifications
Browser compatibility
See also
- Document.requestStorageAccess()
- Using the Storage Access API
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
