The getAllCookieStores()
method of the cookies
API returns a list of all cookie stores.
This is an asynchronous function that returns a Promise
.
The getAllCookieStores()
method of the cookies
API returns a list of all cookie stores.
This is an asynchronous function that returns a Promise
.
let gettingStores = browser.cookies.getAllCookieStores()
None.
A Promise
that will be fulfilled with an array
of cookies.CookieStore
objects representing all the existing cookie stores.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
getAllCookieStores |
Yes |
14Always returns the same default cookie store with ID 0. All cookies belong to this store. |
45Before version 52, only the default cookie store was visible. From version 52 onwards, the cookie stores for private browsing mode and container tabs are also readable. |
? | Yes |
14Always returns the same default cookie store with ID 0. |
? | ? | 48 | ? |
15Always returns the same default cookie store with ID 0. |
? |
In the following snippet, the getAllCookieStores()
method is used to retrieve all the cookie stores currently available in the browser, and print out each cookie store ID, and the tabs that currently share each cookie store.
function logStores(cookieStores) {
for (const store of cookieStores) {
console.log(`Cookie store: ${store.id}\n Tab IDs: ${store.tabIds}`);
}
}
browser.cookies.getAllCookieStores().then(logStores);
Each member of the cookieStores
array is a cookies.CookieStore
object.
Note: This API is based on Chromium's chrome.cookies
API. This documentation is derived from cookies.json
in the Chromium code.
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/cookies/getAllCookieStores