Kekse einstellen, die nicht im Erweiterungspopup erlaubt sind?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Kekse einstellen, die nicht im Erweiterungspopup erlaubt sind?

by Anonymous » 18 Aug 2025, 20:55

Ich versuche, ein Cookie auf der Popup -Seite meiner Erweiterung ohne Erfolg festzulegen. Ich habe zwei verschiedene Methoden ausprobiert ...
Zuerst habe ich document.cookie verwendet, was nichts tut ...

Code: Select all

document.cookie = "SID=1234";
console.log("Current cookie...");
console.log(document.cookie);
< /code>
Konsolenausgabe: < /p>
Current cookie...
[empty line]
Dann habe ich versucht, cookiestore.set () zu verwenden, wodurch ein Fehler ausgeführt wird ...
async function setCookie() {
try {
await cookieStore.set({
name: "SID",
value: "1234"
});
} catch (error) {
console.log(`Error setting SID: ${error}`);
}
}
await setCookie();
< /code>
Konsolenausgabe: < /p>
Error setting SID: TypeError: The domain must domain-match current host
< /code>
Ich habe versucht, die aktuelle Domäne hinzuzufügen, aber das hat auch nicht funktioniert ... < /p>
async function setCookie() {
try {
await cookieStore.set({
name: "SID",
value: "1234",
domain: window.location.href
});
} catch (error) {
console.log(`Error setting SID: ${error}`);
}
}
await setCookie();
< /code>
Konsolenausgabe: < /p>
Error setting SID: TypeError: The domain must domain-match current host
< /code>
Fehlt mir etwas hier? Oder dürfen Sie Cookies einfach nicht auf der Popup -Seite einer Erweiterung einstellen?

Top