Returns a Boolean value indicating whether cookies are enabled or not (read-only).
var cookieEnabled = navigator.cookieEnabled;
cookieEnabled
is a Boolean true
or false
.if (!navigator.cookieEnabled) { // let the user know that enabling cookies makes the web page much more useful }
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of 'Navigator.cookieEnabled' in that specification. | Living Standard | Initial definition |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | 1.0 (1.7 or earlier)[1] | (Yes) | (Yes) | (Yes) |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | ? | (Yes) | 1.0 (1.0)[1] | ? | ? | ? |
[1] Prior to Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5), 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.
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/navigator/cookieEnabled