navigator.oscpu returns a string that identifies the current operating system when the browser exposes it. Learn MDN’s example, typical OS string shapes, feature detection, preference overrides, why sniffing is brittle, five examples, and try-it labs.
01
Kind
Read-only property
02
Returns
String (when present)
03
Status
Non-standard
04
Main engine
Gecko / Firefox
05
Means
OS identity hint
06
Production?
Avoid relying
Fundamentals
Introduction
The name oscpu comes from older browser APIs that tried to answer: “what operating system / CPU platform is this?” On supporting browsers it returns a human-readable OS string.
Today that answer is incomplete across the web. Chromium and Safari typically do not expose a useful oscpu, and even in Firefox the string can be overridden for privacy or testing.
💡
Learn it, don’t depend on it
Use this tutorial to understand legacy Navigator OS strings and to practice feature detection. For real apps, detect capabilities (for example "serviceWorker" in navigator) instead of sniffing the OS.
Concept
Understanding the oscpu Property
When available, reading navigator.oscpu gives a string describing the OS. MDN documents common formats such as Windows NT x.y; Win64; x64 or Linux uname-style output.
Read-only — you inspect; you do not assign.
Non-standard — limited, engine-specific support.
May be missing — treat absence as normal on many browsers.
May be overridden — Firefox general.oscpu.override can replace the true value for non-privileged pages.
Foundation
📝 Syntax
General form of the property:
JavaScript
navigator.oscpu
Value
A string identifying the operating system when supported.
Often undefined / absent outside Gecko.
Common patterns
JavaScript
// Always feature-detect first
if ("oscpu" in navigator && navigator.oscpu) {
console.log(navigator.oscpu);
} else {
console.log("oscpu not available");
}
// MDN-style helper:
function osInfo() {
return navigator.oscpu;
}
Cheat Sheet
⚡ Quick Reference
Goal
Code
Read OS string
navigator.oscpu
Feature detect
"oscpu" in navigator
Safe read
navigator.oscpu || "(absent)"
Type check
typeof navigator.oscpu === "string"
Writable?
No (read-only)
Status (MDN)
Non-standard
Snapshot
🔍 At a Glance
Four facts to remember about navigator.oscpu.
Returns
string
OS identity
Status
non-standard
Limited engines
Access
read-only
No assignment
Best for
learning
Not production sniff
Compare
📋 oscpu vs Feature Detection
navigator.oscpu
Feature detection
Question answered
“What OS string does the browser report?”
“Does this API exist here?”
Portability
Weak (non-standard)
Strong across engines
Can be spoofed / overridden?
Yes (prefs / privacy)
Usually honest about capability presence
Best for
Learning / legacy debugging
Production branching
Example
navigator.oscpu
"serviceWorker" in navigator
Reference
📋 Common oscpu String Shapes (MDN)
Examples of formats MDN documents. Your browser may differ or omit the property entirely.
Operating system
Typical string shape
Windows 64-bit (64-bit build)
Windows NT x.y; Win64; x64
Windows 64-bit (32-bit build)
Windows NT x.y; WOW64
Windows 32-bit
Windows NT x.y
macOS / Mac OS X
Intel Mac OS X or macOS version x.y
Linux
Often uname -sm style output
Hands-On
Examples Gallery
Examples follow MDN navigator.oscpu patterns with safe detection. Prefer Try It Yourself in Firefox to see a real string; Chromium often shows “missing.”
Checking both in and a truthy value avoids treating empty strings as useful OS data.
Example 2 — MDN-Style osInfo()
Read and log the property when present (MDN uses alert; we use console.log).
JavaScript
function osInfo() {
if (!("oscpu" in navigator) || !navigator.oscpu) {
console.log("oscpu not supported");
return;
}
console.log(navigator.oscpu);
}
osInfo();
// Example on some Firefox builds: "Windows NT 10.0; Win64; x64"
navigator.oscpu is non-standard and not universally implemented. Support is strongest in Firefox/Gecko; Chrome, Edge, Safari, and Opera typically omit a useful value. Always feature-detect.
✓ Non-standard · Limited
Navigator.oscpu
Safe to explore for learning. Do not rely on OS sniffing for production feature branching.
LimitedNon-standard
Mozilla FirefoxMay expose oscpu (prefs can override)
Limited
Google ChromeTypically no useful navigator.oscpu
Unavailable
Microsoft EdgeTypically no useful navigator.oscpu
Unavailable
Apple SafariTypically no useful navigator.oscpu
Unavailable
OperaTypically no useful navigator.oscpu
Unavailable
Internet ExplorerNot a modern portable target for oscpu
Unavailable
oscpuLimited
Bottom line: Feature-detect if you must read oscpu. Prefer API feature detection for real application logic. Remember Firefox preference overrides.
Wrap Up
Conclusion
navigator.oscpu is a non-standard OS identification string with limited, Gecko-oriented support. Learn the MDN shapes and always feature-detect — then prefer real capability checks for production code.
Non-standard OS string — often missing or overridden.
5
Core concepts
💻01
Returns
OS string
Type
🔍02
Detect
"oscpu" in navigator
Safe
⚠️03
Status
non-standard
Legacy
🔒04
Override
prefs possible
Caution
🎯05
Prefer
feature detect
Modern
❓ Frequently Asked Questions
When present, it returns a string that identifies the operating system the browser is running on — for example a Windows NT … or Linux … style value. The property is non-standard and often missing outside Gecko/Firefox.
MDN lists it as a non-standard Navigator property (Gecko-oriented). It is not Baseline. Prefer not to rely on it in production. It is not typically labeled Experimental.
Support is strongest in Firefox/Gecko. Chrome, Edge, Safari, and Opera typically return undefined / omit useful support. Always feature-detect.
Yes in Firefox: non-privileged pages may see the general.oscpu.override preference instead of the true platform string (per MDN usage notes).
No. Prefer feature detection for the APIs you need. OS strings are incomplete across browsers, can be overridden, and encourage brittle sniffing.
No. It is a read-only Navigator property when it exists.
Did you know?
The name oscpu dates back to older Netscape / Gecko APIs that exposed “OS + CPU” style platform information. Modern privacy guidance prefers not to leak fine-grained environment details to every website.