I would like to import my cookies for a specific website from Safari to Chrome. I am currently following this answer. The main problem I'm having is I do not know how to indicate which cookies I would like to import.
So far, my manifest.json file looks like this:
{
"name": "CookieImport",
"version": "0.0.0",
"permissions": [
"cookies",
"*://*.armorgames.com/*"
],
"options_page": "options.html",
"manifest_version": 2
}
My options.html file looks like this:
<!doctype html>
<html>
<head></head>
<body>
<script src="options.js"></script>
</body>
</html>
And my options.js file looks like this:
const allCookies = [
{
url: "https://armorgames.com",
name: "__foo",
value: "bar",
domain: ".armorgames.com",
// see all possible fields at:
// https://developer.chrome.com/extensions/cookies#method-set
},
// ... more cookies here
];
const button = document.createElement("button");
button.type = "button";
document.body.appendChild(button);
button.textContent = "Import Cookies";
button.addEventListener("click", () => {
for (const c of allCookies) {
chrome.cookies.set(c, (res) => {
console.log("set", c, res || chrome.runtime.lastError);
});
}
});
After doing loading this to Chrome as an unpacked extension and using the Import Cookies button, there was no change.
I'm aware I can't leave the name and value portion of the options.js file as foo and bar, but what would I put there to specify which cookies to grab?
Also, I've tried leaving out the name and value parts in hope that it would grab everything from the specified domain; this did not work.