JavaScript Navigator cookieEnabled Property

Beginner
5 min read
Updated: Nov 2026
3 examples
Property

Definition

navigator.cookieEnabled is a read-only Boolean that indicates whether cookies are enabled (MDN). Use it as a quick check before cookie-dependent UX.

Read the notes below before you rely on this property. Prefer feature detection when support is limited.

Syntax

Use navigator.cookieEnabled. Start with this line.

JavaScript
navigator.cookieEnabled
CallWhat it does
navigator.cookieEnabledPrimary signature.

Built into the browser. Read navigator.cookieEnabled on Navigator — no import required.

Library declarations
JavaScript
navigator.cookieEnabled

Parameters

ParameterDescription
UI / fallbackOptional. Warn user or use another storage path
Cookie attributesOptional. Secure, SameSite, etc.

Return Value

Return ValueDescription
*The current value of navigator.cookieEnabled.

JavaScript Examples

Example 1 — Read cookieEnabled

Log the Boolean from navigator.

JavaScript
console.log(navigator.cookieEnabled);
console.log(typeof navigator.cookieEnabled); // "boolean"
Try It Yourself

How It Works

  1. Access navigator. Browser environment info lives on navigator.
  2. Read the property. Returns a Boolean immediately.
  3. Check typeof. Confirms it is "boolean", not a string.
  4. No side effects. Reading does not set or clear cookies.

Example 2 — MDN Branch Pattern

Handle the blocked / unsupported case first.

JavaScript
if (!navigator.cookieEnabled) {
  console.log("Cookies unsupported or blocked");
} else {
  console.log("Cookies enabled");
}
Try It Yourself

How It Works

  1. Negate the flag. MDN checks !navigator.cookieEnabled.
  2. Blocked path. Warn or disable cookie features when false.
  3. Enabled path. Continue with normal cookie usage.
  4. Keep it simple. This is the standard first-line check.

Example 3 — User-Facing Message

Build a short status string for your UI.

JavaScript
const msg = navigator.cookieEnabled
  ? "Cookies are enabled in this browser."
  : "Please enable cookies for the best experience.";

console.log(msg);

// Note: even when enabled, SameSite=None usually needs HTTPS + Secure.
Try It Yourself

How It Works

  1. Ternary branch. Pick a string from the Boolean.
  2. Show guidance. Tell users when cookies are off.
  3. Remember limits. Enabled ≠ every attribute succeeds.
  4. Optional next step. Test-write a cookie for critical flows.

Browser Support

navigator.cookieEnabled is marked Baseline Newly available on MDN (since September 2024). It works across the latest devices and browser versions.

✓ Baseline · Newly available

Navigator.cookieEnabled

Read-only Boolean: whether cookies are enabled. High-level check — not a guarantee for every cookie attribute.

Baseline Newly available
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
cookieEnabled Excellent

Bottom line: Safe to use as a first-line cookies check. Still set correct cookie attributes, and verify writes for critical flows when needed.

Frequently Asked Questions

It is a read-only Navigator property that returns a Boolean: true when cookies are enabled, false when the browser does not support cookies or is blocking them from being set.
No. MDN marks it as Baseline Newly available (since September 2024). It is a standard HTML Navigator property — not Deprecated, Experimental, or Non-standard.
Read navigator.cookieEnabled. MDN's pattern: if (!navigator.cookieEnabled) { /* cookies unsupported or blocked */ }.
Not always. Browsers may still block certain cookies in some scenarios — for example SameSite=None cookies often need HTTPS and the Secure attribute. cookieEnabled is a high-level on/off check, not a guarantee for every cookie option.
No. The property is read-only. You read the Boolean; you do not assign to it.
For critical flows, you can also try a short-lived test cookie and verify it was stored. cookieEnabled is the quick first check; a write/read test confirms storage for your site's rules.

Next: credentials

Learn the related Navigator credentials property.

credentials tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

7 people found this page helpful