Cookie question -
deehill opened this issue · 3 comments
Hi Rob.
Looking over the cookie-manager app. I've got a couple of questions and thought I'd ping you to see if you might give me insight.
Say I have multiple TABs and each tab is running a url. If the urls are all of the same "domain" but different pages, how are the "cookies" from the urls tracked? If the url in say TAB1 changes ,and it changes the cookie, does this override the cookie previously changed?
I'm looking to try to create a modified extension that will allow me to monitor when a "cookie" changes in a given "TAB" and to then copy that cookie to another TAB, running another url. Both tabs would be running the same "domain"
thanks
-bruce
Cookies are not only keyed by domain and name, but also by the path
. By default, the path is /
, but you can set the path to something else (e.g. /Rob--W/
, /Rob--W/cookie-manager/
or /Rob--W/cookie-manager/issues/
are possible paths for this page on Github).
You can see this helper method to see which parts of cookie contribute to the identity of a cookie:
cookie-manager/cookie-manager.js
Lines 2689 to 2705 in 99d3c09
I'm looking to test/do this as I'm looking to generate a test extension that I can use to "test" multiple URLs across multiple Tabs
A better solution for your use case is to use the Container Tabs feature of Firefox. Extensions can create new container tab identities using the contextualIdentities
API (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/contextualIdentities) and then open tabs with browser.tabs.create({ url: "...", cookieStoreId: "firefox-container-1234" })
(where firefox-container-1234
is obtained via the contextualIdentities
API).