MDN self-hosted library · e01.org

StorageAccessHandle: SharedWorker() method

Storage Access API

Storage Access API

[!NOTE] See SharedWorker() to understand usage.

Syntax

SharedWorker(url)
SharedWorker(url, name)
SharedWorker(url, options)

Parameters

  • url
  • : See SharedWorker().
  • name
  • : See SharedWorker().
  • options
  • : See SharedWorker().

[!NOTE] options.sameSiteCookies only supports the value "none", which is the default.

Return value

An unpartitioned SharedWorker object.

Exceptions

  • SecurityError DomException
  • : Thrown if access was not granted.

See 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