cookies.getAllCookieStores()

The getAllCookieStores() method of the cookies API returns a list of all cookie stores.

To use this method, an extension must have the "cookies" permission. See cookie permissions for more details.

This is an asynchronous function that returns a Promise.

Syntax

js
let gettingStores = browser.cookies.getAllCookieStores()

Parameters

None.

Return value

A Promise that is fulfilled with an array of cookies.CookieStore objects representing all the cookie stores.

Examples

In this snippet, the getAllCookieStores() method is used to retrieve all the cookie stores available in the browser, and print out each cookie store ID, and the tabs that share each cookie store.

js
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.

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
getAllCookieStores
Chrome – Full support
Chrome 6 (Release date: 2010-09-02)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote
footnote Before 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.
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Partial support
Safari 14 – 17.6 (Release date: 2020-09-16)
footnote Partial support
footnote Always returns the same default cookie store with ID 0.
Safari – Full support
Safari 18 (Release date: 2024-09-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote Full support
Safari on iOS – Partial support
Safari on iOS 15 – 17.6 (Release date: 2021-09-20)
footnote Partial support
footnote Always returns the same default cookie store with ID 0.
Safari on iOS – Full support
Safari on iOS 18 (Release date: 2024-09-16)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
See implementation notes.
Has more compatibility info.

Note: This API is based on Chromium's chrome.cookies API. This documentation is derived from cookies.json in the Chromium code.