Skip to content

Latest commit

 

History

History
81 lines (62 loc) · 3.24 KB

File metadata and controls

81 lines (62 loc) · 3.24 KB
title slug page-type browser-compat
cookies.getAllCookieStores()
Mozilla/Add-ons/WebExtensions/API/cookies/getAllCookieStores
webextension-api-function
webextensions.api.cookies.getAllCookieStores

{{AddonSidebar}}

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

This is an asynchronous function that returns a Promise.

Syntax

let gettingStores = browser.cookies.getAllCookieStores()

Parameters

None.

Return value

A Promise that will be fulfilled with an array of {{WebExtAPIRef('cookies.CookieStore')}} objects representing all the existing cookie stores.

Browser compatibility

{{Compat}}

Examples

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 {{WebExtAPIRef("cookies.CookieStore")}} object.

{{WebExtExamples}}

Note

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