Document: hasUnpartitionedCookieAccess()-Methode

Limited availability

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

Die hasUnpartitionedCookieAccess()-Methode des Document-Interfaces gibt ein Promise zurück, das mit einem booleschen Wert auflöst, der angibt, ob das Dokument Zugriff auf Drittanbieter- und unpartitionierte Cookies hat.

Diese Methode ist Teil der Storage Access API.

Diese Methode ist ein neuer Name für Document.hasStorageAccess().

Syntax

js
hasUnpartitionedCookieAccess()

Parameter

Keine.

Rückgabewert

Ein Promise, das mit einem booleschen Wert auflöst, der angibt, ob das Dokument Zugriff auf Drittanbieter-Cookies hat — true, wenn ja, und false, wenn nicht.

Siehe Document.hasStorageAccess() für weitere Details.

Ausnahmen

InvalidStateError DOMException

Wird ausgelöst, wenn das aktuelle Document noch nicht aktiv ist.

Beispiele

js
document.hasUnpartitionedCookieAccess().then((hasAccess) => {
  if (hasAccess) {
    // storage access has been granted already.
    console.log("cookie access granted");
  } else {
    // storage access hasn't been granted already;
    // you may want to call requestStorageAccess().
    console.log("cookie access denied");
  }
});

Hinweis: Siehe Verwendung der Storage Access API für ein vollständigeres Beispiel.

Spezifikationen

Specification
Extending Storage Access API (SAA) to non-cookie storage
# dom-document-hasunpartitionedcookieaccess

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
hasUnpartitionedCookieAccess

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

Siehe auch