到今天为止navigator.platform的可能值列表是什么? [英] What is the list of possible values for navigator.platform as of today?

查看:1561
本文介绍了到今天为止navigator.platform的可能值列表是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这种情况经常发生变化,但是有一个列表尽可能详尽吗 navigator.platform 返回的可能值?



到目前为止的列表:




  • HP-UX

  • Linux i686

  • Linux armv7l

  • Mac68K

  • MacPPC

  • MacIntel

  • SunOS

  • Win16

  • Win32

  • WinCE

  • iPhone

  • iPod

  • iPad

  • Android

  • BlackBerry

  • Opera


解决方案

免责声明:请注意,此属性由浏览器发送,因此可以伪造,就像用户代理字符串一样。永远不要依赖导航器对象完全准确。






定义



据我所知,没有一个公开列表中包含所有可能的 navigator.platform 值,即使该属性已存在很长时间。更糟糕的是,这些年来该物业的定义发生了变化。它曾经是:


navigator.platform 表示机器的类型浏览器已编译。


这基本上意味着该属性可以返回 Win16 用户正在运行编译为16位的浏览器,即使用户位于32位或64位Windows计算机上。



当然W3Schools列出了旧的定义(我甚至不想和他们联系)。 W3 MDN 已就不同的定义达成一致:


navigator.platform 表示浏览器正在执行的平台。


仍然,这个定义有点模糊。十年前,平台将是CPU架构或操作系统。近年来,手持设备和媒体设备也可以作为平台。






解释

h2>

与网络上的所有内容一样,我们的命运掌握在强大的浏览器供应商手中。在这种情况下,所有主流浏览器(IE,Safari,Firefox和Chrome)都同意我的64位Windows机器是 Win32 平台。这意味着,就Windows而言,它们坚持旧的定义,因为到目前为止它们都没有编译为64位。但是看看好的一面:至少他们都同意一次。



在手持设备和媒体设备方面,我们似乎有点幸运。正如您在问题中已经说过的那样,iPhone,iPod和iPad都具有独特的价值,即使它们都运行相同的操作系统。所有任天堂和索尼的设备也都回归了独特的价值观。所以只有现在 navigator.platform 开始看起来很有趣。



但随后Opera Mini for iPhone出现了,搞乱了事情又来了。 Opera Mini实际上返回了一个代码引擎版本号,这是对 platform 的完全不同的解释,而不是我们到目前为止遇到的任何内容。所以现在我们回到了我们开始的地方,我们开始明白为什么关于这个主题的信息很少。



尽管解释各不相同,但我不知道有一个完整的答案,我觉得我应该为那里的其他人研究 navigator.platform 属性增加2美分。






清单



下面是一个(绝对不是确定的)我知道的值的列表,我可以用多个来源验证。由于模糊的定义,我不太清楚订购这些的最佳方式是什么。目前我根据操作系统或设备品牌将它们划分为几个类别,并列出了适用的附加信息和发布日期。



Android



测试Android设备真的很难。 Android设备将返回 Android ,就像某些版本的Linux一样。例如,在Nexus 5手机上,Android浏览器和Chrome都会返回 Linux armv7l 。在极少数情况下,Android设备甚至可以返回 null (而不是 undefined )。




  • Android (2008)

  • Linux :见上面的注释

  • null



Apple



就iOS而言:Safari,Chrome和Mercury都同意,但Opera会让事情变得混乱。 / p>


  • iPhone (2007)

  • iPod (2007)

  • iPad (2010)

  • iPhone模拟器:Xcode附带的模拟器

  • iPod模拟器:Xcode附带的模拟器

  • iPad模拟器:Xcode随附的模拟器

  • Macintosh

  • MacIntel :英特尔处理器(2005)

  • MacPPC :PowerPC处理器

  • Mac68K :68000处理器

  • Pike v7.6 release 92 :Opera任何iPhone上的Mini 5(2009)

  • Pike v7.8发布517 :任何iPhone上的Opera Mini 7(2012)



BlackBerry




  • BlackBerry (2003)



FreeBSD




  • FreeBSD

  • FreeBSD i386 :x86(IA-32)处理器

  • FreeBSD amd64 :AMD x86-64处理器



Linux



严重不可靠因为这么多平台都建立在这个基础上。例如,ChromeOS或Linux x86-64上的Chrome都返回 Linux i686 ,就像它们编译的那样。



注意Linux ARM列出了架构标志,例如 armv5tej 表示支持Thumb('T')的v5 ARM架构,DSP指令集('E')和Jazelle支持('J')。




  • Linux

  • Linux aarch64

  • Linux armv5tejl

  • Linux armv6l

  • Linux armv7l

  • Linux i686

  • x86_64上的Linux i686

  • Linux i686 X11 :基于X11窗口系统

  • Linux MSM8960_v3.2.1.1_N_R069_Rev:18 :Sony Xperia V

  • Linux ppc64

  • Linux x86_64

  • Linux x86_64 X11 :基于X11窗口系统



Microsoft



即使在64位Windows 8上也是如此他们都坚持 Win32




  • OS / 2 (1994†)

  • 掌上电脑

  • Windows

  • Win16 :Windows 3.1x(1992†)

  • Win32 :Windows 95及以上

  • WinCE



Mozilla



返回空字符串在Firefox OS上。请参阅此错误报告



任天堂




  • 新任天堂3DS (2014)

  • Nintendo DSi (2008)

  • Nintendo 3DS (2011)

  • Nintendo Wii (2006)

  • 任天堂WiiU (2012)



OpenBSD




  • OpenBSD amd64



Symbian / S40




  • Nokia_Series_40 (1999†)

  • S60 (2002†)

  • Symbian :Symbian上的Opera

  • Symbian OS



Palm




  • PalmOS (1996)

  • webOS (2009)



Solaris




  • SunO S

  • SunOS i86pc

  • SunOS sun4u :SPARC处理器



索尼




  • PLAYSTATION 3 (2006)

  • PlayStation 4 (2013)

  • PSP :PlayStation Portable(2004)



各种




  • HP-UX :Hewlett-Packard UniX

  • masking-agent :值更改为此使用Masking Agent for Firefox时

  • WebTV OS

  • X11 :X11窗口系统



有一个设备不在此列表中吗?请留下评论,列出您设备的属性及其 navigator.platform 值(随时可以使用这个JSFiddle 找到价值)。



希望这会有所帮助。


I know that this changes quite often, but is there a list as exhaustive as possible out there of the possible values returned by navigator.platform?

List so far:

  • HP-UX
  • Linux i686
  • Linux armv7l
  • Mac68K
  • MacPPC
  • MacIntel
  • SunOS
  • Win16
  • Win32
  • WinCE
  • iPhone
  • iPod
  • iPad
  • Android
  • BlackBerry
  • Opera

解决方案

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 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

An empty string is returned on 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).

Hope this helps.

这篇关于到今天为止navigator.platform的可能值列表是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆