/Web APIs

CookieStore: getAll() method

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The getAll() method of the CookieStore interface returns a list of cookies that match the name or options passed to it. Passing no parameters will return all cookies for the current context.




name Optional

A string with the name of a cookie.


options Optional

An object containing:


A string with the name of a cookie.


A string with the URL of a cookie.

Note: The url option enables the modification of a cookie scoped under a particular URL. Service workers can obtain cookies that would be sent to any URL under their scope. From a document you may only obtain the cookies at the current URL, so the only valid URL in a document context is the document's URL.

Return value

A Promise that resolves with an array of objects representing cookies that match the given name or options.

Each object contains the following properties:


A string containing the domain of the cookie.


A timestamp, given as Unix time in milliseconds, containing the expiration date of the cookie.


A string containing the name of the cookie.


A boolean indicating whether the cookie is a partitioned cookie (true) or not (false). See Cookies Having Independent Partitioned State (CHIPS) for more information.


A string containing the path of the cookie.


One of the following SameSite values:


Cookies will only be sent in a first-party context and not be sent with requests initiated by third party websites.


Cookies are not sent on normal cross-site subrequests (for example to load images or frames into a third party site), but are sent when a user is navigating within the origin site (i.e. when following a link).


Cookies will be sent in all contexts.


A boolean value indicating whether the cookie is to be used in secure contexts only (true) or not (false).


A string containing the value of the cookie.



Thrown if getting the cookie or cookies represented by the given name or options fails.


In this example we use getAll() with no parameters. This returns all of the cookies for this context as an array of objects.

let cookies = await cookieStore.getAll();
if (cookies) {
} else {
  console.log("Cookie not found");


Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
getAll 87 87 No No 73 No 87 87 No 62 No 14.0
partitioned_return_property 109 109 No No 95 No 109 109 No 74 No No

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.