Dieser Inhalt wurde automatisch aus dem Englischen übersetzt, und kann Fehler enthalten. Erfahre mehr über dieses Experiment.

View in English Always switch to English

StorageAccessHandle: SharedWorker()-Methode

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Hinweis: Siehe SharedWorker(), um die Verwendung zu verstehen.

Syntax

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

Parameter

url

Siehe SharedWorker().

name Optional

Siehe SharedWorker().

options Optional

Siehe SharedWorker().

Hinweis: options.sameSiteCookies unterstützt nur den Wert "none", was der Standard ist.

Rückgabewert

Ein nicht aufgeteilter SharedWorker-Objekt.

Ausnahmen

SecurityError DomException

Ausgelöst, wenn der Zugriff nicht gewährt wurde.

Siehe SharedWorker()

Beispiele

js
document.requestStorageAccess({ SharedWorker: true }).then(
  (handle) => {
    console.log("SharedWorker access granted");
    handle.SharedWorker(shared_worker_url);
  },
  () => {
    console.log("SharedWorker access denied");
  },
);

Hinweis: Siehe Verwendung der Storage Access API für ein umfassenderes Beispiel.

Spezifikationen

Specification
Extending Storage Access API (SAA) to non-cookie storage
# dom-storageaccesshandle-sharedworker

Browser-Kompatibilität

Siehe auch