files/en-us/web/api/storageaccesshandle/sharedworker/index.md
{{APIRef("Storage Access API")}}
[!NOTE] See {{domxref("SharedWorker.SharedWorker", "SharedWorker()")}} to understand usage.
SharedWorker(url)
SharedWorker(url, name)
SharedWorker(url, options)
url
name {{optional_inline}}
options {{optional_inline}}
[!NOTE]
options.sameSiteCookiesonly supports the value "none", which is the default.
An unpartitioned {{domxref("SharedWorker")}} object.
SecurityError {{domxref("DomException")}}
See {{domxref("SharedWorker.SharedWorker", "SharedWorker()")}}
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}}
{{Compat}}