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
orfalse
.
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
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 59 | (Yes) | 1.0 (1.7 or earlier)[1] | (Yes) | (Yes) | (Yes) |
Feature | Android Webview | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | 59 | 59 | (Yes) | 1.0 (1.0)[1] | ? | ? | ? |
[1] Prior to Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5), 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.
Document Tags and Contributors
Tags:
Contributors to this page:
jpmedley,
Tigt,
fmarier,
abbycar,
Sebastianz,
anthonyryan1,
teoli,
MHasan,
kscarfone,
DD0101,
Shraddha_Magdum,
Prachi_Dighe,
Sheppy,
ziyunfei,
Mgjbot,
Nickolay,
Diablownik,
Dria,
JesseW
Last updated by:
jpmedley,