JavaScript Navigator taintEnabled() Method

Beginner
⏱️ 9 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Limited availability
Always returns false

What You’ll Learn

navigator.taintEnabled() is a legacy stub from JavaScript 1.2 data tainting. When the method exists it always returns false. Learn its history, limited browser support, five examples, and why modern security uses other tools.

01

Kind

Method

02

Returns

false (always)

03

Status

Legacy stub

04

Support

Limited (often Firefox)

05

History

JS 1.2 tainting

06

Practical tip

Do not branch on it

Introduction

In very early JavaScript (around 1.2), some engines experimented with data tainting — a security idea that marked values from untrusted sources so scripts could not misuse them casually.

That model was removed long ago. Per MDN, navigator.taintEnabled() remains only so extremely old scripts do not break, and it always returns false when present.

💡
No Dep / Exp / Non-standard banner

MDN’s method page and BCD do not mark this API Experimental or Non-standard, and BCD sets deprecated: false. Tainting itself is obsolete; treat the method as a compatibility stub (similar spirit to javaEnabled()), not a live security switch.

Understanding the taintEnabled() Method

  • No parameters — call navigator.taintEnabled().
  • Return type — boolean false when the method exists.
  • Feature-detect first — many Chromium / Safari builds omit it.
  • HTML / Gecko note — the HTML Standard keeps it mainly for Gecko compatibility mode.
  • Not a modern security API — use CSP, Permissions Policy, CORS, and related tools instead.

📝 Syntax

General form of the method:

JavaScript
navigator.taintEnabled()

Parameters

  • None.

Return value

  • Always the boolean false when the method is implemented.

Safe call pattern

JavaScript
const value =
  typeof navigator.taintEnabled === "function"
    ? navigator.taintEnabled()
    : null; // missing in this browser

console.log(value); // false or null

⚡ Quick Reference

GoalCode
Feature detecttypeof navigator.taintEnabled === "function"
Call (if present)navigator.taintEnabled()
Expected resultfalse
Strict equalitynavigator.taintEnabled() === false
Do not use forReal security / “is tainting on?” UX
Prefer insteadCSP, Permissions Policy, CORS, modern APIs

🔍 At a Glance

Four facts to remember about navigator.taintEnabled().

Returns
false

When present

Support
Limited

Often Firefox

Banners
none

Not Dep / Exp / NS

Use for
learning

Not feature gates

📋 taintEnabled vs javaEnabled

taintEnabled()javaEnabled()
Historical topicJS 1.2 data taintingJava browser plugin / applets
Today’s resultAlways false if presentAlways false
AvailabilityLimited (Gecko-oriented)Widely present (Baseline)
New projectsIgnore for product logicIgnore for product logic

Examples Gallery

Examples show how to detect the method, confirm the always-false contract, and avoid treating it as a live security switch. Output may say missing on Chromium / Safari.

📚 Getting Started

Detect the method, then call it safely.

Example 1 — Feature Detection

Many browsers omit taintEnabled. Check before calling.

JavaScript
const lines = [
  "taintEnabled: " +
    (typeof navigator.taintEnabled === "function" ? "available" : "missing"),
  "javaEnabled: " +
    (typeof navigator.javaEnabled === "function" ? "available" : "missing")
];
console.log(lines.join("\n"));
Try It Yourself

How It Works

Unlike javaEnabled(), taintEnabled() is not universal — detect it every time.

Example 2 — Call When Present

Expect false, or report that the API is missing.

JavaScript
if (typeof navigator.taintEnabled !== "function") {
  console.log("missing");
} else {
  const result = navigator.taintEnabled();
  console.log(String(result));
  console.log("typeof: " + typeof result);
  console.log("strict false: " + (result === false));
}
Try It Yourself

How It Works

Presence means “compatibility stub,” not “tainting is active.”

📈 Practical Patterns

Dead branches, stubs side by side, and modern security tools.

Example 3 — Branch That Never Helps

Even when the method exists, the true path is unreachable.

JavaScript
let mode = "modern-security";
if (
  typeof navigator.taintEnabled === "function" &&
  navigator.taintEnabled()
) {
  mode = "js12-tainting"; // never assigned when method returns false
}
console.log(mode);
Try It Yourself

How It Works

If you see this in ancient samples, delete the branch — it cannot turn tainting back on.

Example 4 — Beside javaEnabled()

Two historical stubs that return false when available.

JavaScript
const summary = {
  taintEnabled:
    typeof navigator.taintEnabled === "function"
      ? navigator.taintEnabled()
      : null,
  javaEnabled:
    typeof navigator.javaEnabled === "function"
      ? navigator.javaEnabled()
      : null
};
console.log(JSON.stringify(summary));
Try It Yourself

How It Works

null means missing API; false means stub answered “no.”

Example 5 — Prefer Modern Security Checks

Beginner-friendly replacement mindset: inspect real browser security surfaces.

JavaScript
function securitySnapshot() {
  return {
    taintEnabled:
      typeof navigator.taintEnabled === "function"
        ? navigator.taintEnabled()
        : "missing",
    isSecureContext: window.isSecureContext,
    cookieEnabled: navigator.cookieEnabled,
    tip: "Use CSP / Permissions / CORS — not taintEnabled()"
  };
}

console.log(JSON.stringify(securitySnapshot()));
Try It Yourself

How It Works

Keep taintEnabled() for history lessons; ship modern platform security features.

🚀 Common Use Cases

  • Learning / interviews — explain JS 1.2 tainting and why the stub returns false.
  • Reading ancient scripts — recognize dead if (taintEnabled()) branches.
  • Engine quirks — understand Gecko compatibility vs Chromium omission.
  • Teaching feature detection — contrast missing APIs vs always-false stubs.
  • Not for product security — never gate CSP or auth on this method.

🧠 How navigator.taintEnabled() Works

1

Feature-detect

Check typeof navigator.taintEnabled === "function".

Detect
2

Call the stub

If present, invoke with no arguments.

Call
3

Always false

Engines return boolean false for compatibility.

Result
4

Use modern security

Prefer CSP, Permissions Policy, CORS, and secure contexts.

📝 Notes

  • Limited availability — mainly Firefox / Gecko; missing in many Chromium and Safari builds.
  • Not Experimental / Non-standard; BCD deprecated: false — no status banner required.
  • Always returns false when implemented — JS 1.2 tainting is gone.
  • Similar learning cousin: javaEnabled().
  • Related: unregisterProtocolHandler(), share(), javaEnabled(), canShare().

Limited Browser Support

navigator.taintEnabled() is a legacy compatibility stub. Per MDN / BCD it is present mainly in Firefox (and historically IE / old Opera). Chrome and Safari typically omit it. When present, the return value is always false.

Limited · Always false

Navigator.taintEnabled()

JS 1.2 tainting leftover — returns false for old-script compatibility.

Limited Not universal
Mozilla Firefox Method present · always false
Supported
Google Chrome Typically not implemented
Unavailable
Microsoft Edge Typically not implemented (Chromium)
Unavailable
Apple Safari Typically not implemented
Unavailable
Opera Removed in modern Opera / Chromium era
Unavailable
Internet Explorer Historical support · always false later
Legacy
taintEnabled() Limited (stub)

Bottom line: Feature-detect before calling, expect false when present, and never use this method for modern security decisions.

Conclusion

navigator.taintEnabled() is a leftover from JavaScript 1.2 data tainting. Feature-detect it, expect false when it exists, and do not build security UX around it. Modern apps rely on CSP, permissions, CORS, and secure contexts instead.

Continue with unregisterProtocolHandler(), javaEnabled(), or the JavaScript hub.

💡 Best Practices

✅ Do

  • Feature-detect before calling
  • Expect false when present
  • Treat it as history / interviews material
  • Compare with javaEnabled() carefully
  • Ship CSP / Permissions / CORS for security

❌ Don’t

  • Assume every browser has the method
  • Gate product features on the return value
  • Confuse it with real data-flow security
  • Call without a typeof check
  • Use it instead of modern platform defenses

Key Takeaways

Knowledge Unlocked

Five things to remember about taintEnabled()

Legacy JS 1.2 stub — always false when the method exists.

5
Core concepts
📊 02

Result

always false

Stub
🌐 03

Support

Limited

Often Firefox
🔎 04

Detect

typeof function

First
🚫 05

Avoid

security gates

Use CSP+

❓ Frequently Asked Questions

It is a legacy Navigator method from the old JavaScript 1.2 data-tainting security model. Today, when the method exists, it always returns the boolean false.
MDN’s method page and browser-compat data do not mark it Experimental or Non-standard, and BCD sets deprecated to false. Tainting itself was removed long ago; the method is only a compatibility stub. No Deprecated / Experimental / Non-standard status banner is required on this tutorial.
Data tainting was removed after JavaScript 1.2. Engines that still expose taintEnabled() keep it only so very old scripts do not throw, and the HTML rule is to return false.
Support is limited. It is mainly a Firefox / Gecko compatibility API. Chrome and Safari typically do not implement it. Always feature-detect before calling.
No. Calling it teaches history, but 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.
Did you know?

The HTML Standard still mentions taintEnabled() mainly so Gecko’s navigator compatibility mode can match old content fingerprints — the method must return false, not revive tainting.

Explore unregisterProtocolHandler() Next

Remove a web protocol handler with the matching scheme and %s URL.

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.

8 people found this page helpful