W3cubDocs

/Web APIs

Navigator: oscpu property

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

The Navigator.oscpu property returns a string that identifies the current operating system.

Value

A string providing a string which identifies the operating system on which the browser is running.

Operating system oscpuInfo string format
OS/2 OS/2 Warp x (either 3, 4 or 4.5)
Windows CE WindowsCE x.y
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
Mac OS X (PPC build) PowerPC Mac OS X version x.y
Mac OS X (i386/x64 build) Intel Mac OS X or macOS version x.y
Linux 64-bit (32-bit build) Output of uname -s followed by i686 on x86_64
Linux Output of uname -sm

In this table x.y refers to the version of the operating system

Examples

js

function osInfo() {
  alert(navigator.oscpu);
}

osInfo(); // alerts "Windows NT 6.0" for example

Usage notes

Unless your code is privileged (chrome or at least has the UniversalBrowserRead privilege), it may get the value of the general.oscpu.override preference instead of the true platform.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
oscpu No No
1The preference "general.oscpu.override" can be used to set a value to be returned instead of the true CPU description. The preference setting is ignored for calls made by privileged code, which continue to get the actual CPU description.
No No No No No
4The preference "general.oscpu.override" can be used to set a value to be returned instead of the true CPU description. The preference setting is ignored for calls made by privileged code, which continue to get the actual CPU description.
No No No

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Navigator/oscpu