Example 1 — Basic appCodeName
Log the property in the current browser.
console.log(navigator.appCodeName);
// Mozilla How It Works
Whatever browser you use for Try It, MDN’s rule holds: the value is "Mozilla".

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.
Read-only property
"Mozilla"
Compatibility only
Do not use
Widely available
Feature detection
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.
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.
appCodeName PropertyappCodeName is a read-only string on Navigator. Historically it meant “internal code name.” In practice it is a fixed compatibility value.
"Mozilla" in conforming browsers.appName and related Navigator strings.General form of the property:
navigator.appCodeName "Mozilla".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
} | Goal | Code |
|---|---|
| Read the value | navigator.appCodeName |
| Expected string | "Mozilla" |
| Equality check | navigator.appCodeName === "Mozilla" |
| Type | typeof navigator.appCodeName // "string" |
| Identify browser? | No — do not sniff with this |
| Better approach | Feature detection on APIs / CSS |
Four facts to remember about appCodeName.
"Mozilla"Every browser
stringRead-only
legacyCompatibility
avoidNot a brand
appCodeName vs feature detectionappCodeName sniffing | Feature detection | |
|---|---|---|
| Question asked | “Which browser brand?” | “Does this API exist?” |
| Reliability | Poor (always Mozilla) | High for capability checks |
| Example | appCodeName === "Mozilla" | "serviceWorker" in navigator |
| Breaks when | You assume a real brand | Rarely — you test the feature |
| Best for | Understanding legacy code | Real application logic |
Examples follow MDN Navigator.appCodeName behavior. Use View Output or Try It Yourself for each case.
Read the property and confirm the fixed value.
appCodeNameLog the property in the current browser.
console.log(navigator.appCodeName);
// Mozilla Whatever browser you use for Try It, MDN’s rule holds: the value is "Mozilla".
"Mozilla"Show the boolean check beginners often expect to branch on.
const codeName = navigator.appCodeName;
const isMozillaLabel = codeName === "Mozilla";
console.log(codeName);
console.log("isMozillaLabel: " + isMozillaLabel);
// Mozilla
// isMozillaLabel: true The check is true almost everywhere — which proves it cannot identify a specific browser brand.
Types, userAgent contrast, and a better detection style.
Treat it as a normal string for learning JavaScript basics.
const name = navigator.appCodeName;
console.log(typeof name);
console.log(name.length);
console.log(name.toUpperCase());
// string
// 7
// MOZILLA Even a legacy property is still a JavaScript string — useful for teaching typeof and methods.
userAgentappCodeName stays fixed; userAgent is long and still unreliable for sniffing.
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")); Both strings often start with “Mozilla,” which is exactly why old sniffing was confusing.
Check capabilities instead of code names.
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")); Feature detection answers “can I use this?” — the question your app actually cares about.
navigator.appCodeName fails.appCodeName WorksYour script accesses navigator.appCodeName.
Spec / compatibility: value is "Mozilla".
Legacy checks that expected Mozilla do not break.
Use feature detection for real capability checks.
"Mozilla" — not a real product name.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.
Safe to read anywhere — but treat it as a fixed legacy string, not a brand detector.
Bottom line: You can read appCodeName in any modern browser. Never branch product logic on it — use feature detection instead.
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.
"Mozilla" means Firefox onlyappCodeNameappCodeNameA legacy Navigator string that always says Mozilla.
"Mozilla"
Alwaysstring property
APIcompatibility
Legacydo not use
Avoidfeature detect
ModernMany 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.
The sibling legacy string that always says Netscape.
8 people found this page helpful