contextualIdentities.remove()
Entfernt eine kontextuelle Identität anhand ihrer Cookie-Store-ID.
Dies ist eine asynchrone Funktion, die ein Promise
zurückgibt.
Syntax
js
let removeContext = browser.contextualIdentities.remove(
cookieStoreId // string
)
Parameter
-
string
. Die ID des Cookie-Stores der kontextuellen Identität. Da kontextuelle Identitäten jeweils ihren eigenen Cookie-Store haben, dient dies als Kennung für die kontextuelle Identität selbst.
Rückgabewert
Ein Promise
, das mit einer ContextualIdentity
erfüllt wird, die die Identität beschreibt, die entfernt wurde. Wenn die Identität nicht gefunden werden konnte oder die Funktion für kontextuelle Identitäten nicht aktiviert ist, wird das Promise abgelehnt.
Beispiele
Dieses Beispiel versucht, die kontextuelle Identität zu entfernen, deren ID "firefox-container-1" ist:
js
function onRemoved(context) {
if (!context) {
console.error("Context not found");
} else {
console.log(`Removed identity: ${context.cookieStoreId}.`);
}
}
function onError(e) {
console.error(e);
}
browser.contextualIdentities
.remove("firefox-container-1")
.then(onRemoved, onError);
Browser-Kompatibilität
Loading…