JavaScript Navigator appCodeName Property

Beginner
⏱️ 8 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Read-only property

What You’ll Learn

navigator.appCodeName is a legacy Navigator property. Per MDN, its value is always "Mozilla" in any browser — kept only for compatibility. Learn what it returns, why sniffing fails, five examples, and better alternatives.

01

Kind

Read-only property

02

Returns

"Mozilla"

03

Purpose

Compatibility only

04

Sniffing?

Do not use

05

Baseline

Widely available

06

Prefer

Feature detection

Introduction

Long ago, sites checked the browser “code name” to decide which features to enable. That led to fragile sniffing. Today every major browser still reports appCodeName as "Mozilla" so old pages keep working.

So if you log navigator.appCodeName in Chrome, Edge, Firefox, or Safari, you will almost always see the same string: Mozilla.

💡
MDN warning

Do not rely on this property to return a real product name. All browsers return "Mozilla".

Learn it so legacy code makes sense — then use feature detection for real apps.

Understanding the appCodeName Property

appCodeName is a read-only string on Navigator. Historically it meant “internal code name.” In practice it is a fixed compatibility value.

  • Value is always "Mozilla" in conforming browsers.
  • Kept for old scripts that expected that string.
  • Useless for telling Chrome apart from Firefox or Safari.
  • Part of the same legacy family as appName and related Navigator strings.

📝 Syntax

General form of the property:

JavaScript
navigator.appCodeName

Value

  • The string "Mozilla".

Common patterns

JavaScript
console.log(navigator.appCodeName); // "Mozilla"

// Always true in modern browsers:
const isLegacyMozillaLabel =
  navigator.appCodeName === "Mozilla";

// Prefer feature detection instead of sniffing:
if ("geolocation" in navigator) {
  // safe to use navigator.geolocation
}

⚡ Quick Reference

GoalCode
Read the valuenavigator.appCodeName
Expected string"Mozilla"
Equality checknavigator.appCodeName === "Mozilla"
Typetypeof navigator.appCodeName // "string"
Identify browser?No — do not sniff with this
Better approachFeature detection on APIs / CSS

🔍 At a Glance

Four facts to remember about appCodeName.

Value
"Mozilla"

Every browser

Kind
string

Read-only

Use for
legacy

Compatibility

Sniffing
avoid

Not a brand

📋 appCodeName vs feature detection

appCodeName sniffingFeature detection
Question asked“Which browser brand?”“Does this API exist?”
ReliabilityPoor (always Mozilla)High for capability checks
ExampleappCodeName === "Mozilla""serviceWorker" in navigator
Breaks whenYou assume a real brandRarely — you test the feature
Best forUnderstanding legacy codeReal application logic

Examples Gallery

Examples follow MDN Navigator.appCodeName behavior. Use View Output or Try It Yourself for each case.

📚 Getting Started

Read the property and confirm the fixed value.

Example 1 — Basic appCodeName

Log the property in the current browser.

JavaScript
console.log(navigator.appCodeName);
// Mozilla
Try It Yourself

How It Works

Whatever browser you use for Try It, MDN’s rule holds: the value is "Mozilla".

Example 2 — Always Equals "Mozilla"

Show the boolean check beginners often expect to branch on.

JavaScript
const codeName = navigator.appCodeName;
const isMozillaLabel = codeName === "Mozilla";

console.log(codeName);
console.log("isMozillaLabel: " + isMozillaLabel);
// Mozilla
// isMozillaLabel: true
Try It Yourself

How It Works

The check is true almost everywhere — which proves it cannot identify a specific browser brand.

📈 Practical Patterns

Types, userAgent contrast, and a better detection style.

Example 3 — Type and Length

Treat it as a normal string for learning JavaScript basics.

JavaScript
const name = navigator.appCodeName;
console.log(typeof name);
console.log(name.length);
console.log(name.toUpperCase());
// string
// 7
// MOZILLA
Try It Yourself

How It Works

Even a legacy property is still a JavaScript string — useful for teaching typeof and methods.

Example 4 — Contrast with userAgent

appCodeName stays fixed; userAgent is long and still unreliable for sniffing.

JavaScript
const lines = [];
lines.push("appCodeName: " + navigator.appCodeName);
lines.push("userAgent starts: " + navigator.userAgent.slice(0, 24) + "…");
lines.push(
  "appCodeName alone identifies brand? " +
    (navigator.appCodeName !== "Mozilla" ? "maybe" : "no")
);
console.log(lines.join("\n"));
Try It Yourself

How It Works

Both strings often start with “Mozilla,” which is exactly why old sniffing was confusing.

Example 5 — Prefer Feature Detection

Check capabilities instead of code names.

JavaScript
const lines = [];
lines.push("appCodeName: " + navigator.appCodeName + " (ignore for sniffing)");
lines.push(
  "geolocation API: " +
    ("geolocation" in navigator ? "available" : "missing")
);
lines.push(
  "serviceWorker: " +
    ("serviceWorker" in navigator ? "available" : "missing")
);
console.log(lines.join("\n"));
Try It Yourself

How It Works

Feature detection answers “can I use this?” — the question your app actually cares about.

🚀 Common Use Cases

  • Learning Navigator — first read-only string properties on navigator.
  • Reading legacy code — understand why old scripts check for Mozilla.
  • Teaching anti-patterns — show why sniffing with appCodeName fails.
  • Not for production branching — do not gate features on this value.
  • Debugging myths — prove Chrome still reports Mozilla here.

🧠 How appCodeName Works

1

Page reads navigator

Your script accesses navigator.appCodeName.

Read
2

Browser returns fixed string

Spec / compatibility: value is "Mozilla".

Value
3

Old scripts keep working

Legacy checks that expected Mozilla do not break.

Compat
4

Modern apps ignore it

Use feature detection for real capability checks.

📝 Notes

  • Always "Mozilla" — not a real product name.
  • Kept only for compatibility with old content.
  • Do not use for browser or engine detection.
  • Baseline Widely available across modern browsers.
  • Related: appName, activeVRDisplays, Window, JavaScript hub.

Universal Browser Support

navigator.appCodeName is Baseline Widely available. Every major browser exposes it and returns "Mozilla" for compatibility. Support does not mean it is useful for identifying browsers.

Baseline · Widely available

Navigator.appCodeName

Safe to read anywhere — but treat it as a fixed legacy string, not a brand detector.

Universal Widely 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
appCodeName Excellent

Bottom line: You can read appCodeName in any modern browser. Never branch product logic on it — use feature detection instead.

Conclusion

navigator.appCodeName is a tiny piece of web history: a read-only string that always says "Mozilla". Know it for interviews and legacy code — then move on to feature detection for real applications.

Continue with appName, Window methods, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Treat the value as a fixed compatibility string
  • Use feature detection for APIs you need
  • Document legacy sniffing when maintaining old code
  • Teach beginners why sniffing fails with this property
  • Prefer progressive enhancement over brand checks

❌ Don’t

  • Assume "Mozilla" means Firefox only
  • Gate Chrome/Safari features on appCodeName
  • Expect a unique product name per browser
  • Build new detection libraries on this property
  • Confuse compatibility support with usefulness

Key Takeaways

Knowledge Unlocked

Five things to remember about appCodeName

A legacy Navigator string that always says Mozilla.

5
Core concepts
🔒 02

Read-only

string property

API
🔁 03

Why

compatibility

Legacy
🚫 04

Sniffing

do not use

Avoid
05

Prefer

feature detect

Modern

❓ Frequently Asked Questions

In every modern browser it returns the string "Mozilla". The property exists only for historical compatibility with very old scripts.
No. MDN warns not to rely on it for a real product name. Chrome, Edge, Safari, Firefox, and others all report "Mozilla".
Early browsers pretended to be Mozilla so sites that sniffed user-agent strings would still work. appCodeName kept that compatibility habit.
No. It is a read-only Navigator property. You read it; you do not assign a new value.
Prefer feature detection (for example "geolocation" in navigator or CSS/API checks) over reading appCodeName, appName, or brittle user-agent parses.
Yes. MDN marks it Baseline Widely available — but that does not mean it is useful for identifying browsers.
Did you know?

Many userAgent strings also start with Mozilla/5.0 for the same historical reason. That prefix is about compatibility theater, not proof you are running the original Mozilla browser.

Learn appName Next

The sibling legacy string that always says Netscape.

appName →

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