Since September 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
navigator.cookieEnabled returns a Boolean value that indicates whether cookies are enabled or not.
The property is read-only.
A boolean.
Note: Web browsers may prevent writing certain cookies in certain scenarios. For example, Chrome-based browsers, as well as some experimental version of Firefox, does not allow creating cookies with SameSite=None attribute, unless they are created over HTTPS and with Secure attribute.
if (!navigator.cookieEnabled) {
// The browser does not support or is blocking cookies from being set.
}
| Specification |
|---|
| HTML> # dom-navigator-cookieenabled-dev> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
cookieEnabled |
1 | 12 | 1Before Firefox 8,navigator.cookieEnabled would report the wrong result if a site exception was in place for the page on which the check was performed. This has been fixed. |
≤12.1 | 181–18Returnstrue even if the browser is set to block cookies if navigator.cookieEnabled is invoked inside a third-party iframe) |
18 | 4Before Firefox for Android 8,navigator.cookieEnabled would report the wrong result if a site exception was in place for the page on which the check was performed. This has been fixed. |
≤12.1 | 181–18Returnstrue even if the browser is set to block cookies if navigator.cookieEnabled is invoked inside a third-party iframe) |
1.0 | 4.4 | 181–18Returnstrue even if the browser is set to block cookies if navigator.cookieEnabled is invoked inside a third-party iframe) |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Navigator/cookieEnabled