cookies

Enables extensions to get, set, and remove cookies, and be notified when they change.

Permissions

For an extension to use this API, it must specify the "cookies" API permission in its manifest.json file and host permissions for any sites whose cookies it wants to access. The extension can get, set, or remove any cookies that can be read, written, or deleted by a URL matching the host permissions. For example:

http://*.example.com/

An extension with this host permission can:

  • Read a non-secure cookie for www.example.com with any path.
  • Write a secure or non-secure cookie for www.example.com with any path.

It can not:

  • Read a secure cookie for www.example.com.
http://www.example.com/

An extension with this host permission can:

  • Read a non-secure cookie for www.example.com with any path.
  • Read a non-secure cookie for .example.com with any path.
  • Write a secure or non-secure cookie for www.example.com with any path.
  • Write a secure or non-secure cookie for .example.com with any path.

It can not:

  • Read or write a cookie for foo.example.com.
  • Read or write a cookie for foo.www.example.com.
*://*.example.com/

An extension with this host permission can:

  • Read or write a secure or non-secure cookie for www.example.com with any path.

Tracking protection

Trackers use third-party cookies, that is, cookies set by a website other than the one you are on, to identify the websites you visit. For example:

  1. You visit a-shopping-site.com, which uses ad-tracker.com to deliver its adverts on the web. ad-tracker.com sets a cookie associated with the ad-tracker.com domain. While you are on a-shopping-site.com, ad-tracker.com receives information about the products you browse.
  2. You now visit a-news-site.com that uses ad-tracker.com to deliver adverts. ad-tracker.com read its cookie and use the information collected from a-shopping-site.com to decide which adverts to display to you.

Firefox includes two features to prevent tracking: dynamic partitioning and first-party isolation. These features separate cookies so that trackers cannot make an association between websites visited. So, in the preceding example, ad-tracker.com cannot see the cookie created on a-news-site.com when visiting a-shopping-site.com.

From Firefox 103, dynamic partitioning is the default feature used. However, if the user or an extension turns on first-party isolation, it takes precedence over dynamic partitioning.

Note: When private browsing uses dynamic partitioning, normal browsing may not be partitioning cookies. See Status of partitioning in Firefox, for details.

Storage partitioning

When using dynamic partitioning, Firefox partitions the storage accessible to JavaScript APIs by top-level site while providing appropriate access to unpartitioned storage to enable common use cases. This feature is being rolled out progressively. See Status of partitioning in Firefox, for implementation details.

Storage partitions are keyed by the schemeful URL of the top-level website and, when dynamic partitioning is active, the key value is available through the partitionKey.topLevelSite property in the cookies API, for example, partitionKey: {topLevelSite: "http://site"}.

Generally, top-level documents are in unpartitioned storage, while third-party iframes are in partitioned storage. If a partition key cannot be determined, the default (unpartitioned storage) is used. For example, while all HTTP(S) sites can be used as a partition key, moz-extension:- URLs cannot. Therefore, iframes in Firefox's extension documents do not use partitioned storage.

By default, cookies.get(), cookies.getAll(), cookies.set(), and cookies.remove() work with cookies in unpartitioned storage. To work with cookies in partitioned storage in these APIs, topLevelSite in partitionKey must be set. The exception is getAll, where setting partitionKey without topLevelSite returns cookies in partitioned and unpartitioned storage. cookies.onChanged fires for any cookie that the extension can access, including cookies in partitioned storage. To ensure that the correct cookie is modified, extensions should read the cookie.partitionKey property from the event and pass its value to cookies.set() and cookies.remove().

First-party isolation

When first-party isolation is on, cookies are qualified by the domain of the original page the user visited (essentially, the domain shown to the user in the URL bar, also known as the "first-party domain").

First-party isolation can be enabled by the user by adjusting the browser's configuration and set by extensions using the firstPartyIsolate setting in the privacy API. Note that first-party isolation is enabled by default in Tor Browser.

The cookies API represents the first-party domain using the firstPartyDomain attribute. All cookies set while first-party isolation is on have this attribute set to the domain of the original page. In the preceding example, this is a-shopping-site.com for one cookie and a-news-site.com for the other. When first-party isolation is off, all cookies set by websites have this property set to an empty string.

The cookies.get(), cookies.getAll(), cookies.set() and cookies.remove() APIs all accept a firstPartyDomain option.

When first-party isolation is on, you must provide this option or the API call fails and returns a rejected promise. For get(), set(), and remove() you must pass a string value. For getAll(), you may also pass null here, and this gets all cookies, whether or not they have a non-empty value for firstPartyDomain.

When first-party isolation is off, the firstPartyDomain parameter is optional and defaults to an empty string. A non-empty string can be used to retrieve or modify first-party isolation cookies. Likewise, passing null as firstPartyDomain to getAll() returns all cookies.

Types

cookies.Cookie

Represents information about an HTTP cookie.

cookies.CookieStore

Represents a cookie store in the browser.

cookies.OnChangedCause

Represents the reason a cookie changed.

cookies.SameSiteStatus

Represents the same-site status of the cookie.

Methods

cookies.get()

Retrieves information about a single cookie.

cookies.getAll()

Retrieves all cookies that match a given set of filters.

cookies.set()

Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.

cookies.remove()

Deletes a cookie by name.

cookies.getAllCookieStores()

Lists all existing cookie stores.

Event handlers

cookies.onChanged

Fired when a cookie is set or removed.

Example extensions

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
cookies
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 Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-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 – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
Cookie
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 Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-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 – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
Cookie.expirationDate
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 Includes milliseconds in the fractional part from Firefox 142.
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote
footnote Includes milliseconds in the fractional part from Firefox 142.
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
Cookie.firstPartyDomain
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 59 (Release date: 2018-03-13)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 59 (Release date: 2018-03-13)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Cookie.partitionKey
Chrome – Full support
Chrome 119 (Release date: 2023-10-31)
footnote Full support
Edge – Full support
Edge 119 (Release date: 2023-11-02)
footnote Full support
Firefox – Full support
Firefox 94 (Release date: 2021-11-02)
footnote Full support
Opera – Full support
Opera 105 (Release date: 2023-11-14)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 94 (Release date: 2021-11-02)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Cookie.sameSite
Chrome – Full support
Chrome 51 (Release date: 2016-05-25)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 63 (Release date: 2018-10-23)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 63 (Release date: 2018-10-23)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
CookieStore
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 Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-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 – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
CookieStore.id
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 Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-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 – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
CookieStore.incognito
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 52 (Release date: 2017-03-07)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 52 (Release date: 2017-03-07)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
CookieStore.tabIds
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 52 (Release date: 2017-03-07)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 52 (Release date: 2017-03-07)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
OnChangedCause
Chrome – Full support
Chrome 58 (Release date: 2017-04-19)
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 Full support
Opera – Full support
Opera 45 (Release date: 2017-05-10)
footnote Full support
Safari – No support
Safari
footnote
footnote See bug 267514
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote
footnote See bug 267514
get
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 Provides access to cookies from private browsing mode and container tabs since version 52.
footnote From Firefox 133, sorts cookies according to RFC 6265, section 5.4. This means the cookie with the longest matching path is returned; previously, the earliest created cookie was returned.
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 HttpOnly cookies are not retrieved.
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 HttpOnly cookies are not retrieved.
Safari on iOS – Full support
Safari on iOS 18 (Release date: 2024-09-16)
footnote Full support
get.firstPartyDomain
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 59 (Release date: 2018-03-13)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 59 (Release date: 2018-03-13)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
get.partitionKey
Chrome – Full support
Chrome 119 (Release date: 2023-10-31)
footnote Full support
Edge – Full support
Edge 119 (Release date: 2023-11-02)
footnote Full support
Firefox – Full support
Firefox 94 (Release date: 2021-11-02)
footnote Full support
Opera – Full support
Opera 105 (Release date: 2023-11-14)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 94 (Release date: 2021-11-02)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
getAll
Chrome – Full support
Chrome 6 (Release date: 2010-09-02)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote
footnote If no URL is provided, cookies are retrieved only for URLs in currently opened tabs. In Chrome, this gets all cookies on a user's machine.
Firefox – Full support
Firefox 45 (Release date: 2016-03-08)
footnote
footnote Before version 52, the 'tabIds' list was empty and only cookies from the default cookie store were returned. From version 52 onwards, this has been fixed and the result includes cookies from private browsing mode and container tabs.
footnote From Firefox 133, sorts cookies according to RFC 6265, section 5.4. This means the cookie with the longest matching path is returned first: previously, the earliest created cookie was returned first.
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 Only the cookies in the default cookie store are retrieved.
footnote HttpOnly cookies are not retrieved.
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 Only the cookies in the default cookie store are retrieved.
footnote HttpOnly cookies are not retrieved.
Safari on iOS – Full support
Safari on iOS 18 (Release date: 2024-09-16)
footnote Full support
getAll.firstPartyDomain
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 59 (Release date: 2018-03-13)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 59 (Release date: 2018-03-13)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
getAll.partitionKey
Chrome – Full support
Chrome 119 (Release date: 2023-10-31)
footnote Full support
Edge – Full support
Edge 119 (Release date: 2023-11-02)
footnote Full support
Firefox – Full support
Firefox 94 (Release date: 2021-11-02)
footnote Full support
Opera – Full support
Opera 105 (Release date: 2023-11-14)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 94 (Release date: 2021-11-02)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
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
onChanged
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 Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-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 – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
onChanged.partitionKey
Chrome – Full support
Chrome 119 (Release date: 2023-10-31)
footnote Full support
Edge – Full support
Edge 119 (Release date: 2023-11-02)
footnote Full support
Firefox – Full support
Firefox 94 (Release date: 2021-11-02)
footnote Full support
Opera – Full support
Opera 105 (Release date: 2023-11-14)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 94 (Release date: 2021-11-02)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
remove
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 56, this function did not remove cookies from private browsing mode. From version 56 onwards this is fixed.
footnote From Firefox 133, sorts cookies according to RFC 6265, section 5.4. This means the cookie with the longest matching path is deleted: previously, the earliest created cookie was deleted.
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote
footnote Before version 56, this function did not remove cookies from private browsing mode. From version 56 onwards this is fixed.
footnote From Firefox 133, sorts cookies according to RFC 6265, section 5.4. This means the cookie with the longest matching path is deleted: previously, the earliest created cookie was deleted.
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
remove.firstPartyDomain
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 59 (Release date: 2018-03-13)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 59 (Release date: 2018-03-13)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
remove.partitionKey
Chrome – Full support
Chrome 119 (Release date: 2023-10-31)
footnote Full support
Edge – Full support
Edge 119 (Release date: 2023-11-02)
footnote Full support
Firefox – Full support
Firefox 94 (Release date: 2021-11-02)
footnote Full support
Opera – Full support
Opera 105 (Release date: 2023-11-14)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 94 (Release date: 2021-11-02)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
sameSiteStatus
Chrome – Full support
Chrome 51 (Release date: 2016-05-25)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 63 (Release date: 2018-10-23)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 63 (Release date: 2018-10-23)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
sameSiteStatus.lax
Chrome – Full support
Chrome 51 (Release date: 2016-05-25)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 63 (Release date: 2018-10-23)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 63 (Release date: 2018-10-23)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
sameSiteStatus.no_restriction
Chrome – Full support
Chrome 51 (Release date: 2016-05-25)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 63 (Release date: 2018-10-23)
footnote
footnote Represents a cookie without a SameSite attribute.
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 63 (Release date: 2018-10-23)
footnote
footnote Represents a cookie without a SameSite attribute.
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
sameSiteStatus.strict
Chrome – Full support
Chrome 51 (Release date: 2016-05-25)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 63 (Release date: 2018-10-23)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 63 (Release date: 2018-10-23)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
sameSiteStatus.unspecified
Chrome – Full support
Chrome 76 (Release date: 2019-07-30)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 140 (Release date: 2025-06-24)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 140 (Release date: 2025-06-24)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
set
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 56, this function did not modify cookies in private browsing mode. From version 56 onwards this is fixed.
footnote From Firefox 133, sorts cookies according to RFC 6265, section 5.4. This means the cookie returned by the promise is the one with the longest matching path: previously, the earliest created cookie was returned.
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 Only sets cookies in the default cookie store.
footnote HttpOnly cookies are not set.
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
footnote Before version 56, this function did not modify cookies in private browsing mode. From version 56 onwards this is fixed.
footnote From Firefox 133, sorts cookies according to RFC 6265, section 5.4. This means the cookie returned by the promise is the one with the longest matching path: previously, the earliest created cookie was returned.
Safari on iOS – Partial support
Safari on iOS 15 – 17.6 (Release date: 2021-09-20)
footnote Partial support
footnote Only sets cookies in the default cookie store.
footnote HttpOnly cookies are not set.
Safari on iOS – Full support
Safari on iOS 18 (Release date: 2024-09-16)
footnote Full support
set.expirationDate
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 Can include milliseconds in the fractional part from Firefox 142.
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote
footnote Can include milliseconds in the fractional part from Firefox 142.
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
set.firstPartyDomain
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 59 (Release date: 2018-03-13)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 59 (Release date: 2018-03-13)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
set.partitionKey
Chrome – Full support
Chrome 119 (Release date: 2023-10-31)
footnote Full support
Edge – Full support
Edge 119 (Release date: 2023-11-02)
footnote Full support
Firefox – Full support
Firefox 94 (Release date: 2021-11-02)
footnote Full support
Opera – Full support
Opera 105 (Release date: 2023-11-14)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – Full support
Firefox for Android 94 (Release date: 2021-11-02)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
set.sameSite
Chrome – Full support
Chrome 51 (Release date: 2016-05-25)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 63 (Release date: 2018-10-23)
footnote
footnote Until Firefox 139, defaults to no_restriction. From Firefox 140, defaults to unspecified.
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 63 (Release date: 2018-10-23)
footnote
footnote Until Firefox for Android 139, defaults to no_restriction. From Firefox for Android 140, defaults to unspecified.
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support

Legend

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

Full support
Full support
Partial support
Partial support
No support
No 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.