Navigator.cookieEnabled

navigator.cookieEnabled returns a Boolean value that indicates whether cookies are enabled or not. The property is read-only.

Syntax

var cookieEnabled = navigator.cookieEnabled;
  • cookieEnabled is a Boolean: true or false.
Note: When the browser is configured to block third-party cookies, and navigator.cookieEnabled is invoked inside a third-party iframe, it returns true in Safari, Edge Spartan and IE (while trying to set a cookie in such scenario would fail). It returns false in Firefox and Chromium-based browsers.
Note: Web browsers may prevent writing certain cookies in certain scenarios. For example, Chrome 80+ does not allow creating cookies with SameSite=None attribute, unless they are created over HTTPS and with Secure attribute.

Example

if (!navigator.cookieEnabled) { 
  // The browser does not support or is blocking cookies from being set.
}

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'Navigator.cookieEnabled' in that specification.
Living Standard Initial definition

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
cookieEnabledChrome Full support 1Edge Full support 12Firefox Full support 1
Notes
Full support 1
Notes
Notes Prior to 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.
IE Full support YesOpera Full support YesSafari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4
Notes
Full support 4
Notes
Notes Prior to 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.
Opera Android Full support YesSafari iOS Full support 1Samsung Internet Android Full support 7.0

Legend

Full support  
Full support
See implementation notes.
See implementation notes.