What Is the List of Possible Values for Navigator.Platform as of Today

What is the list of possible values for navigator.platform as of today?

Disclaimer: please note this property is sent by the browser and can thus be faked, just like user agent strings. Never rely on the navigator object to be completely accurate.

The definition

As far as I know there isn't a single public list of all possible `navigator.platform` values, even though the property has been around for quite a bit. To make things worse, the property's definition changed throughout the years. It used to be:

navigator.platform indicates the machine type for which the browser was compiled.

This basically means the property can return Win16 when the user is running a browser compiled for 16-bit, even though the user is on a 32-bit or 64-bit Windows machine.

Of course W3Schools lists the old definition (I'm not even gonna link to them). W3 and MDN have agreed on a different definition though:

navigator.platform represents the platform on which the browser is executing.

Still, this definition is a bit vague. A decade ago a 'platform' would either be a CPU architecture or an operating system. In recent years handheld and media devices can be platforms too.



The interpretation

As with everything on the web, our fate is in the hands of the mighty browser vendors. In this case, all the major browsers (IE, Safari, Firefox and Chrome) agree that my 64-bit Windows machine is a `Win32` platform. This means they're sticking to the old definition as far as Windows goes, because none of them are compiled for 64-bit thus far. Look on the bright side though: at least they all agree on something for once.

It seems like we're a bit luckier when it comes to handheld and media devices. As you've already stated in your question, the iPhone, iPod and iPad each got a unique value, even though they're all running the same operating system. All of Nintendo's and Sony's devices are returning unique values too. So only now navigator.platform is starting to look interesting.

But then Opera Mini for iPhone comes along, messing things up again. Opera Mini actually returns a code engine version number, which is a completely different interpretation of platform than anything we've come across so far. So now we're back where we started and we start to understand why there's so little information on this subject out there.

Even though the interpretations vary and I don't have a complete answer for you, I did feel like I should add my 2 cents for anyone else out there researching the navigator.platform property.



The list

Below is a (definitely non-definite) list of the values I know of that I could verify with multiple sources. Because of the vague definition, I'm not too sure what the best way to order these is. For now I divided them into a few categories based on operating system or device brand and listed additional information and release dates where applicable.

Android

It's really hard to test for Android devices. Android devices will return Android just as often as some version of Linux. For example on a Nexus 5 phone, both the Android browser and Chrome return Linux armv7l. In rare cases Android devices can even return null (instead of undefined).

  • Android (2008)
  • Linux: see notes above
  • null

Apple

As far as iOS goes: Safari, Chrome and Mercury agree, but Opera messes things up.

  • iPhone (2007)
  • iPod (2007)
  • iPad (2010)
  • iPhone Simulator: simulator shipped with Xcode
  • iPod Simulator: simulator shipped with Xcode
  • iPad Simulator: simulator shipped with Xcode
  • Macintosh
  • MacIntel: Intel processor (2005)
  • MacPPC: PowerPC processor
  • Mac68K: 68000 processor
  • Pike v7.6 release 92: Opera Mini 5 on any iPhone (2009)
  • Pike v7.8 release 517: Opera Mini 7 on any iPhone (2012)

BlackBerry

  • BlackBerry (2003)

FreeBSD

  • FreeBSD
  • FreeBSD i386: x86 (IA-32) processor
  • FreeBSD amd64: AMD x86-64 processor

Linux

Seriously unreliable because so many platforms are built on this. For example, Chrome on ChromeOS or Linux x86-64 both return Linux i686 as that's what they were compiled for.

Note Linux ARM lists architecture flags, e.g. armv5tej would denote a v5 ARM architecture with Thumb support ('T'), a DSP instruction set ('E'), and Jazelle support ('J').

  • Linux
  • Linux aarch64
  • Linux armv5tejl
  • Linux armv6l
  • Linux armv7l
  • Linux armv8l
  • Linux i686
  • Linux i686 on x86_64
  • Linux i686 X11: based on X11 Window System
  • Linux MSM8960_v3.2.1.1_N_R069_Rev:18: Sony Xperia V
  • Linux ppc64
  • Linux x86_64
  • Linux x86_64 X11: based on X11 Window System

Microsoft

Even on a 64-bit Windows 8 they all stick to Win32.

  • OS/2 (1994†)
  • Pocket PC
  • Windows
  • Win16: Windows 3.1x (1992†)
  • Win32: Windows 95 and up
  • WinCE

Mozilla (Firefox OS)

An empty string is returned in the web browser on Firefox OS. See this bug report.

KaiOS

The web browser on KaiOS (based on Firefox) also returns the empty string (same as Firefox OS). See this bug report.

Nintendo

  • New Nintendo 3DS (2014)
  • Nintendo DSi (2008)
  • Nintendo 3DS (2011)
  • Nintendo Wii (2006)
  • Nintendo WiiU (2012)

OpenBSD

  • OpenBSD amd64

Symbian / S40

  • Nokia_Series_40 (1999†)
  • S60 (2002†)
  • Symbian: Opera on Symbian
  • Symbian OS

Palm

  • PalmOS (1996)
  • webOS (2009)

Solaris

  • SunOS
  • SunOS i86pc
  • SunOS sun4u: SPARC processor

Sony

  • PLAYSTATION 3 (2006)
  • PlayStation 4 (2013)
  • PSP: PlayStation Portable (2004)

Various

  • HP-UX: Hewlett-Packard UniX
  • masking-agent: value changes to this when using Masking Agent for Firefox
  • WebTV OS
  • X11: X11 Window System

Have a device that's not on this list? Please leave a comment listing your device's properties and its navigator.platform value (feel free to use this JSFiddle to find the value).

(Javascript) List of navigator.appName values for all browsers?

If you trust the user agent, you can use this web site:
http://www.useragentstring.com/

It provides an API to analyse your current browser. It also has data on about every user agent you can imagine.

How can I fool a site that looks at the JavaScript object 'navigator' to see that I'm not on Windows?

Since you can't directly set navigator.platform, you will have to be sneaky - create an object that behaves like navigator, replace its platform, then set navigator to it.

var fake_navigator = {};

for (var i in navigator) {
fake_navigator[i] = navigator[i];
}

fake_navigator.platform = 'MyOS';

navigator = fake_navigator;

If you execute this code before the document loads (using GreaseMonkey, an addon or a Chrome extension), then the page will see navigator.platform as "MyOS".

Note: tested only in Chrome.

How to determine browser platform without navigator.platform

It turns out that the only realistic option for now is to look at the User Agent string and make decisions based on that (either by handrolling code, or using a user agent parsing library that does that for you).

This is not ideal, but as the goal is OS detection, and explicitly not browser detection, it's also not too hacky or liable to break in the future.

Issue: Audit usage of navigator.userAgent, navigator.appVersion, and navigator.platform

The reason one sees the message is well explained in the description of the very same message (audit).

The real question is who/what is the source of it. There is a hint to the file extended-css.js.

Here is an example with another file (as I do not have the extended-css.js):
Sample Image

Right click on the file and then choose Open in new tab.

Sample Image

So there you can see that the reason for the audit message is the hook.js file from the Vue.js devtools extension.

In your case it would be another extension or library you are using - direct or indirect (for example a part of vuetify, etc.).

From there you have 3 choices:

  1. ignore it
  2. wait for the authors of the library to fix the issue and update it
  3. disable the extension/remove the library causing it.


Related Topics



Leave a reply



Submit