Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 804351 of Navigator.cookieEnabled

  • Revision slug: Web/API/Navigator/cookieEnabled
  • Revision title: Navigator.cookieEnabled
  • Revision id: 804351
  • Created:
  • Creator: anthonyryan1
  • Is current revision? No
  • Comment Version information update.

Revision Content

{{ ApiRef("HTML DOM") }}

Returns a Boolean value indicating whether cookies are enabled or not (read-only).

Syntax

var cookieEnabled = navigator.cookieEnabled;
  • cookieEnabled is a Boolean true or false.

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) }} {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }}
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.

Specifications

HTML WHATWG

Revision Source

<p>{{ ApiRef("HTML DOM") }}</p>

<p>Returns a Boolean value indicating whether cookies are enabled or not (read-only).</p>

<h2 id="Syntax" name="Syntax">Syntax</h2>

<pre class="eval">
var cookieEnabled = navigator.cookieEnabled;
</pre>

<ul>
 <li><code>cookieEnabled</code> is a Boolean <code>true</code> or <code>false</code>.</li>
</ul>

<h2 id="Example" name="Example">Example</h2>

<pre class="brush: js">
if (!navigator.cookieEnabled) { 
  // let the user know that enabling cookies makes the web page much more useful
}
</pre>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{ CompatibilityTable() }}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>Yes</td>
   <td>{{ CompatGeckoDesktop(1.0) }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatGeckoMobile(1.0) }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
  </tr>
 </tbody>
</table>
</div>

<h3 id="Gecko_notes">Gecko notes</h3>

<p>Prior to Gecko 8.0 {{ geckoRelease("8.0") }}, <code>window.navigator.cookieEnabled</code> 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.</p>

<h2 id="Specification" name="Specification">Specifications</h2>

<p>HTML WHATWG</p>
Revert to this revision