Dokument: 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 Dokument-Interfaces gibt ein Promise zurück, das mit einem booleschen Wert aufgelöst wird, 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
hasUnpartitionedCookieAccess()
Parameter
Keine.
Rückgabewert
Ein Promise, das mit einem booleschen Wert aufgelöst wird, der angibt, ob das Dokument Zugriff auf Drittanbieter-Cookies hat — true, wenn ja, und false, wenn nicht.
Sehen Sie Document.hasStorageAccess() für weitere Details.
Ausnahmen
InvalidStateErrorDOMException-
Wird ausgelöst, wenn das aktuelle
Dokumentnoch nicht aktiv ist.
Beispiele
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
Loading…