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 472599 of Navigator.cookieEnabled

  • Revision slug: Web/API/Navigator.cookieEnabled
  • Revision title: Navigator.cookieEnabled
  • Revision id: 472599
  • Created:
  • Creator: DD0101
  • Is current revision? No
  • Comment Works in Chrome

Revision Content

{{ DomRef() }}

Summary

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) }} {{ 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" } ) }}

Revision Source

<p>{{ DomRef() }}</p>
<h3 id="Summary" name="Summary">Summary</h3>
<p>Returns a Boolean value indicating whether cookies are enabled or not (read-only).</p>
<h3 id="Syntax" name="Syntax">Syntax</h3>
<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>
<h3 id="Example" name="Example">Example</h3>
<pre class="brush: js">
if (!navigator.cookieEnabled) { 
  // let the user know that enabling cookies makes the web page much more useful
}
</pre>
<h3 id="Browser_compatibility">Browser compatibility</h3>
<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>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</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>
<h3 id="Specification" name="Specification">Specification</h3>
<p>{{ DOM0() }}</p>
<p>{{ languages( {"ja": "ja/DOM/window.navigator.cookieEnabled","zh-cn": "zh-cn/DOM/window.navigator.cookieEnabled", "pl": "pl/DOM/window.navigator.cookieEnabled" } ) }}</p>
Revert to this revision