{{ ApiRef() }}
Summary
Returns a Boolean value indicating whether cookies are enabled or not (read-only).
Syntax
var cookieEnabled = navigator.cookieEnabled;
cookieEnabled
is a Booleantrue
orfalse
.
Example
if (!navigator.cookieEnabled) { // let the user know that enabling cookies makes the web page much more useful }
Browser compatibility
{{ CompatibilityTable() }}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | Yes | {{ CompatGeckoDesktop(1.0) }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | {{ CompatUnknown() }} | {{ CompatGeckoMobile(1.0) }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} |
Gecko notes
Prior to Gecko 8.0 {{ geckoRelease("8.0") }}, window.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.
Specification
{{ DOM0() }}
{{ languages( {"ja": "ja/DOM/window.navigator.cookieEnabled","zh-cn": "zh-cn/DOM/window.navigator.cookieEnabled", "pl": "pl/DOM/window.navigator.cookieEnabled" } ) }}