JavaScript Navigator taintEnabled() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Method

Definition

navigator.taintEnabled() is a legacy Navigator method from JavaScript 1.2 data tainting. MDN: that model was removed long ago; the method remains only for old scripts and always returns false.

Pass the required arguments shown below. Check return values and browser support before you rely on the result.

Syntax

Call navigator.taintEnabled. Start with this line.

JavaScript
navigator.taintEnabled()
CallWhat it does
navigator.taintEnabled()Primary signature.
navigator.taintEnabled(...)Call with the arguments your case needs.

Built into the browser. Call taintEnabled(...) on a Navigator — no import required.

Library declarations
JavaScript
navigator.taintEnabled()

Parameters

This member has no parameters beyond those shown in the signature.

Return Value

Return ValueDescription
*Always false when implemented

JavaScript Examples

Example 1 — Feature-Detect First

Many engines never expose taintEnabled. Check before calling.

JavaScript
const supported = typeof navigator.taintEnabled === "function";
console.log(supported);

if (supported) {
  console.log(navigator.taintEnabled()); // false
} else {
  console.log("missing (common outside Gecko)");
}
Try It Yourself

How It Works

  1. Test the type so missing methods do not throw.
  2. Expect missing in Chrome / Edge / Safari.
  3. On Firefox, the method often exists as a stub.
  4. Literacy only — do not build product logic on it.

Example 2 — Call Returns false (MDN)

When the method exists, MDN’s contract is simple: always false.

JavaScript
if (typeof navigator.taintEnabled === "function") {
  const result = navigator.taintEnabled();
  console.log(result);           // false
  console.log(typeof result);    // "boolean"
} else {
  console.log("unsupported");
}
Try It Yourself

How It Works

  1. No arguments — empty call list (MDN).
  2. Boolean false every time the stub is implemented.
  3. HTML / Gecko mode requires that return value.
  4. Not a live security flag — tainting is gone.

Example 3 — Why if (taintEnabled()) Is Dead

Recognize this pattern in old scripts — the branch never runs today.

JavaScript
// Legacy pattern (do not copy into new apps):
if (typeof navigator.taintEnabled === "function" && navigator.taintEnabled()) {
  console.log("tainting on"); // never prints
} else {
  console.log("tainting off / unsupported");
}

// Prefer modern security instead of this check.
Try It Yourself

How It Works

  1. Old scripts gated behavior on tainting being enabled.
  2. Today the call is false, so the if body never runs.
  3. Missing method also falls through to the else path.
  4. Replace with CSP / permissions — not this stub.

Browser Support

navigator.taintEnabled() is a legacy Gecko compatibility stub. MDN: always returns false when present. Chrome and Safari typically do not implement it.

✓ Deprecated · Compatibility stub

Navigator.taintEnabled()

JS 1.2 data-tainting leftover — literacy only. Expect false or missing.

Legacy Avoid in new code
Mozilla Firefox Supported (always false)
Legacy
Google Chrome Typically unsupported
No
Microsoft Edge Typically unsupported
No
Apple Safari Typically unsupported
No
Opera Legacy Opera only / check
No
Internet Explorer No modern use
No
taintEnabled() Gecko stub / often missing

Bottom line: Recognize in old scripts; never ship new logic on it. See the MDN taintEnabled() reference.

Frequently Asked Questions

MDN: it always returns false. It is a leftover from JavaScript 1.2 data tainting, kept only so very old scripts do not break.
Yes in practice — MDN lists it among deprecated Navigator methods. The tainting security model was removed long ago; the method is only a compatibility stub that returns false.
Data tainting was removed after JavaScript 1.2. Engines that still expose taintEnabled() keep it for compatibility, and the HTML rule is to return false.
Limited. Mainly Firefox / Gecko compatibility. Chrome and Safari typically do not implement it. Always feature-detect before calling.
No. if (navigator.taintEnabled()) never enables a real security feature. Prefer modern APIs (CSP, permissions, CORS, SameSite cookies, etc.).
Both are historical stubs that return false when present. javaEnabled() was about the Java plugin; taintEnabled() was about JS 1.2 data tainting. javaEnabled() is widely present; taintEnabled() is more Firefox-oriented.

Next: unregisterProtocolHandler()

Continue with the next Navigator method in the tutorial series.

unregisterProtocolHandler() →

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.

22 people found this page helpful