Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

cookies.getAllCookieStores()

この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ MDN に参加して翻訳を手伝ってください!

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

Syntax

chrome.cookies.getAllCookieStores(
  function(cookieStores) {...} // callback function
)

This API is also available as browser.cookies.getAllCookieStores() in a version that returns a promise.

Parameters

callback
A callback function, which is passed the following parameter when the method call completes:
cookieStores
An array of cookies.CookieStore objects representing all the existing cookie stores.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic support Yes Yes 45.0 48.0 33

Compatibility notes

Edge

  • Always returns the same default cookie store with ID 0. All cookies belong to this store.

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.

chrome.cookies.getAllCookieStores(function(cookieStores) {
  for(var i = 0; i < cookieStores.length; i++) {
    console.log('Cookie store: ' + cookieStores[i].id +
                '\n Tab IDs: ' + cookieStores[i].tabIds);
  }
});

Each member of the cookieStores array is a cookies.CookieStore object.

Acknowledgements

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

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

ドキュメントのタグと貢献者

 このページの貢献者: Makyen, wbamberg, chrisdavidmills
 最終更新者: Makyen,