cookieEnabled
navigator.cookieEnabled returns a Boolean value that indicates whether cookies are enabled or not.
The property is read-only.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 1 | 12 | 1 | 18 | 18 | 18 | |
1+Supported (version) Not supported ※Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Implementation note
- Before 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.
Notes 3 item(s)
Limitation
- This browser only partially implements this feature
Removed
- This feature was removed in a later browser version (18)
Implementation note
- Returns `true` even if the browser is set to block cookies if `navigator.cookieEnabled` is invoked inside a third-party `iframe`)
Notes 3 item(s)
Limitation
- This browser only partially implements this feature
Removed
- This feature was removed in a later browser version (18)
Implementation note
- Returns `true` even if the browser is set to block cookies if `navigator.cookieEnabled` is invoked inside a third-party `iframe`)
Syntax
JAVASCRIPT
if (!navigator.cookieEnabled) {
// The browser does not support or is blocking cookies from being set.
} Use cases
-
Using cookieEnabled
navigator.
Cautions
- May not be supported in older browsers.
Implementation notes
- Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.