getAllCookieStores()
方法在
Cookie
API returns a list of all cookie stores.
This is an asynchronous function that returns a
Promise
.
var gettingStores = browser.cookies.getAllCookieStores()
None.
A
Promise
that will be fulfilled with an
array
of
cookies.CookieStore
objects representing all the existing cookie stores.
BCD tables only load in the browser
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 (let store of cookieStores) {
console.log(`Cookie store: ${store.id}\n Tab IDs: ${store.tabIds}`);
}
}
var getting = browser.cookies.getAllCookieStores();
getting.then(logStores);
Each member of the
cookieStores
array is a
cookies.CookieStore
对象。
注意:
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.
最后修改: , 由 MDN 贡献者