javascript 截至今天,navigator.platform 的可能值列表是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19877924/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the list of possible values for navigator.platform as of today?
提问by thomasstephn
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
?
我知道这经常发生变化,但是是否有一个尽可能详尽的列表来列出由 返回的可能值navigator.platform
?
List so far:
到目前为止的清单:
- HP-UX
- Linux i686
- Linux armv7l
- Mac68K
- MacPPC
- MacIntel
- SunOS
- Win16
- Win32
- WinCE
- iPhone
- iPod
- iPad
- Android
- BlackBerry
- Opera
- 用户体验
- Linux i686
- linux armv7l
- Mac68K
- MacPPC
- 英特尔
- 太阳操作系统
- Win16
- Win32
- 电脑版
- iPhone
- iPod
- iPad
- 安卓
- 黑莓
- 歌剧
回答by Robbert
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.
免责声明:请注意此属性是由浏览器发送的,因此可以伪造,就像用户代理字符串一样。永远不要依赖navigator
对象是完全准确的。
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
值的公共列表,即使该属性已经存在了很长时间。更糟糕的是,该物业的定义多年来发生了变化。它曾经是:
navigator.platform
indicates the machine type for which the browser was compiled.
navigator.platform
表示编译浏览器的机器类型。
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.
这基本上意味着该属性可以Win16
在用户运行为 16 位编译的浏览器时返回,即使用户使用的是 32 位或 64 位 Windows 机器。
Of course W3Schools lists the old definition (I'm not even gonna link to them). W3and MDNhave agreed on a different definition though:
当然,W3Schools 列出了旧定义(我什至不打算链接到它们)。W3和MDN已经同意了不同的定义:
navigator.platform
represents the platform on which the browser is executing.
navigator.platform
表示浏览器正在执行的平台。
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.
尽管如此,这个定义还是有点模糊。十年前,“平台”要么是 CPU 架构,要么是操作系统。近年来,手持设备和媒体设备也可以成为平台。
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.
与网络上的一切一样,我们的命运掌握在强大的浏览器供应商手中。在这种情况下,所有主要浏览器(IE、Safari、Firefox 和 Chrome)都同意我的 64 位 Windows 机器是一个Win32
平台。这意味着就 Windows 而言,它们坚持旧定义,因为到目前为止,它们都没有针对 64 位进行编译。不过,从好的方面来看:至少他们一次就某事达成了一致。
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.
在手持设备和媒体设备方面,我们似乎更幸运一些。正如您在问题中已经指出的那样,iPhone、iPod 和 iPad 都有独特的价值,即使它们都运行相同的操作系统。任天堂和索尼的所有设备也都在返回独特的价值。所以现在才navigator.platform
开始看起来很有趣。
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.
但后来 iPhone 版 Opera Mini 出现了,又把事情搞砸了。Opera Mini 实际上返回了一个代码引擎版本号,这platform
与我们目前遇到的任何东西都完全不同。所以现在我们又回到了起点,我们开始理解为什么关于这个主题的信息如此之少。
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.
尽管解释各不相同并且我没有完整的答案给你,但我确实觉得我应该为其他任何研究该navigator.platform
房产的人增加我的 2 美分。
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 设备进行测试真的很难。Android 设备将Android
与某些版本的 Linux 一样频繁地返回。例如,在 Nexus 5 手机上,Android 浏览器和 Chrome 都返回Linux armv7l
. 在极少数情况下,Android 设备甚至可以返回null
(而不是undefined
)。
Android
(2008)Linux
: see notes abovenull
Android
(2008)Linux
: 见上面的注释null
Apple
苹果
As far as iOS goes: Safari, Chrome and Mercury agree, but Opera messes things up.
就 iOS 而言:Safari、Chrome 和 Mercury 同意,但 Opera 把事情搞砸了。
iPhone
(2007)iPod
(2007)iPad
(2010)iPhone Simulator
: simulator shipped with XcodeiPod Simulator
: simulator shipped with XcodeiPad Simulator
: simulator shipped with XcodeMacintosh
MacIntel
: Intel processor (2005)MacPPC
: PowerPC processorMac68K
: 68000 processorPike v7.6 release 92
: Opera Mini 5 on any iPhone (2009)Pike v7.8 release 517
: Opera Mini 7 on any iPhone (2012)
iPhone
(2007)iPod
(2007)iPad
(2010)iPhone Simulator
: Xcode 附带的模拟器iPod Simulator
: Xcode 附带的模拟器iPad Simulator
: Xcode 附带的模拟器Macintosh
MacIntel
: 英特尔处理器 (2005)MacPPC
: PowerPC 处理器Mac68K
: 68000 处理器Pike v7.6 release 92
:任何 iPhone 上的 Opera Mini 5 (2009)Pike v7.8 release 517
:任何 iPhone 上的 Opera Mini 7 (2012)
BlackBerry
黑莓
BlackBerry
(2003)
BlackBerry
(2003)
FreeBSD
FreeBSD
FreeBSD
FreeBSD i386
: x86 (IA-32) processorFreeBSD amd64
: AMD x86-64 processor
FreeBSD
FreeBSD i386
: x86 (IA-32) 处理器FreeBSD amd64
: AMD x86-64 处理器
Linux
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.
严重不可靠,因为很多平台都建立在此之上。例如,ChromeOS 或 Linux x86-64 上的 Chrome 都返回,Linux i686
因为这就是它们被编译的目的。
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 ARM 列出了架构标志,例如armv5tej
将表示具有 Thumb 支持 ('T')、DSP 指令集 ('E') 和 Jazelle 支持 ('J') 的 v5 ARM 架构。
Linux
Linux aarch64
Linux armv5tejl
Linux armv6l
Linux armv7l
Linux i686
Linux i686 on x86_64
Linux i686 X11
: based on X11 Window SystemLinux MSM8960_v3.2.1.1_N_R069_Rev:18
: Sony Xperia VLinux ppc64
Linux x86_64
Linux x86_64 X11
: based on X11 Window System
Linux
Linux aarch64
Linux armv5tejl
Linux armv6l
Linux armv7l
Linux i686
Linux i686 on x86_64
Linux i686 X11
: 基于 X11 窗口系统Linux MSM8960_v3.2.1.1_N_R069_Rev:18
: 索尼 Xperia VLinux ppc64
Linux x86_64
Linux x86_64 X11
: 基于 X11 窗口系统
Microsoft
微软
Even on a 64-bit Windows 8 they all stick to Win32
.
即使在 64 位 Windows 8 上,它们也都坚持使用Win32
.
OS/2
(1994?)Pocket PC
Windows
Win16
: Windows 3.1x (1992?)Win32
: Windows 95 and upWinCE
OS/2
(1994?)Pocket PC
Windows
Win16
: Windows 3.1x (1992?)Win32
: Windows 95 及更高版本WinCE
Mozilla (Firefox OS)
Mozilla(火狐操作系统)
An empty string is returned in the web browser on Firefox OS. See this bug report.
在 Firefox OS 上的 Web 浏览器中返回一个空字符串。请参阅此错误报告。
KaiOS
卡iOS
The web browser on KaiOS (based on Firefox) also returns the empty string (same as Firefox OS). See this bug report.
KaiOS 上的网络浏览器(基于 Firefox)也返回空字符串(与 Firefox OS 相同)。请参阅此错误报告。
Nintendo
任天堂
New Nintendo 3DS
(2014)Nintendo DSi
(2008)Nintendo 3DS
(2011)Nintendo Wii
(2006)Nintendo WiiU
(2012)
New Nintendo 3DS
(2014)Nintendo DSi
(2008)Nintendo 3DS
(2011)Nintendo Wii
(2006)Nintendo WiiU
(2012)
OpenBSD
开放式BSD
OpenBSD amd64
OpenBSD amd64
Symbian / S40
塞班/S40
Nokia_Series_40
(1999?)S60
(2002?)Symbian
: Opera on SymbianSymbian OS
Nokia_Series_40
(1999?)S60
(2002?)Symbian
: Symbian 上的 OperaSymbian OS
Palm
棕榈
PalmOS
(1996)webOS
(2009)
PalmOS
(1996)webOS
(2009)
Solaris
索拉里斯
SunOS
SunOS i86pc
SunOS sun4u
: SPARC processor
SunOS
SunOS i86pc
SunOS sun4u
: SPARC 处理器
Sony
索尼
PLAYSTATION 3
(2006)PlayStation 4
(2013)PSP
: PlayStation Portable (2004)
PLAYSTATION 3
(2006)PlayStation 4
(2013)PSP
: PlayStation Portable (2004)
Various
各种各样的
HP-UX
: Hewlett-Packard UniXmasking-agent
: value changes to this when using Masking Agent for FirefoxWebTV OS
X11
: X11 Window System
HP-UX
: 惠普 Unixmasking-agent
: 使用 Masking Agent for Firefox 时,此值会更改WebTV OS
X11
: X11 窗口系统
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 JSFiddleto find the value).
有不在此列表中的设备?请发表评论,列出您设备的属性及其navigator.platform
价值(请随意使用此 JSFiddle来查找价值)。
Hope this helps.
希望这可以帮助。
回答by BillyRayPreachersSon
I can add to this list with definitive values for specific devices I've tested.
我可以将我测试过的特定设备的确定值添加到此列表中。
Where the string is Linux armv7l
, it ends in a lowercase L
(for "Linux, presumably?), rather than being a number 1
or lowercase I
.
字符串在哪里Linux armv7l
,它以小写结尾L
(对于“Linux,大概?),而不是数字1
或小写I
。
For the iOS devices, testing was performed in Safari. For the Android devices, testing was performed in the stock browser, or Chrome if no stock browser was installed.
对于 iOS 设备,测试是在 Safari 中进行的。对于 Android 设备,在股票浏览器中进行测试,如果未安装股票浏览器,则在 Chrome 中进行测试。
Of the Windows tablet devices, the Nokia Lumia was running Windows RT 8.1 with IE 11.0.9600.16476, and the MS Surface was running Windows 8.1 Pro with IE 11.0.9600.16438.
在 Windows 平板设备中,诺基亚 Lumia 运行的是 Windows RT 8.1 和 IE 11.0.9600.16476,而 MS Surface 运行的是 Windows 8.1 Pro 和 IE 11.0.9600.16438。
Of the Windows phones devices, the Nokia Lumia was running Windows Phone 8.1 and IE 11.
在 Windows 手机设备中,诺基亚 Lumia 运行的是 Windows Phone 8.1 和 IE 11。
Phones
电话
Device OS window.navigator.platform
---------------------------------------------------------------------------
iPhone 4 iOS 7.1 iPhone
iPhone 5 iOS 7.1.1 iPhone
iPhone 5c iOS 7.1 iPhone
iPhone 5s iOS 7.1 iPhone
Samsung Galaxy S2 Android 4.1.2 Linux armv7l
Samsung Galaxy S3 Mini Android 4.1.2 Linux armv7l
Samsung Galaxy S3 Android 4.3 Linux armv7l
Samsung Galaxy S4 Android 4.4.2 Linux armv7l
Samsung Galaxy Note 3 Android 4.4.2 Linux armv7l
Samsung Galaxy S6 Android 5 Linux aarch64
Nexus 4 Android 4.4.2 Linux armv7l
Nexus 5 Android 4.4.2 Linux armv7l
HTC One Android 4.4.2 Linux armv7l
Sony Xperia Z Android 4.2.2 Linux armv7l
Motorola Moto G Android 4.4.2 Linux armv7l
Nokia Lumia 1520 Windows 8.1 Win32
Tablets
平板电脑
Device OS window.navigator.platform
---------------------------------------------------------------------------
iPad 2nd generation iOS 6.1.3 iPad
iPad 2nd generation iOS 7.0.3 iPad
iPad 4th generation iOS 6.1.2 iPad
iPad 4th generation iOS 6.1.3 iPad
iPad mini (non retina) iOS 6.1.3 iPad
iPad mini (retina) iOS 7.0.3 iPad
Samsung Galaxy Tab 2 7" Android 4.0.3 Linux armv7l
Samsung Galaxy Tab 3 7" Android 4.1.2 Linux armv7l
Samsung Galaxy Tab 3 Android 4.2.2 Linux i686
Samsung Galaxy Note 10.1 (2012) Android 4.1.2 Linux armv7l
Samsung Galaxy Note 10.1 (2014) Android 4.3 Linux armv7l
Nexus 7 (2012) 7" Android 4.4.3 Linux armv7l
Nexus 7 (2013) 7" Android 4.3 Linux armv7l
Nexus 10 Android 4.4.2 Linux armv7l
Lenovo Yoga Android 4.2.2 Linux armv7l
Sony Xperia Z Android 4.3 Linux armv7l
Tesco Hudl 7" Android 4.2.2 Linux armv7l
Kindle Fire 7" (2012) Unknown Linux armv7l
Kindle Fire HDX 7" (2013) Unknown Linux armv7l
Asus Transformer Pad TF300T Android 4.0.3 Linux armv7l
Nokia Lumia 2520 Windows RT 8.1 Win32
MS Surface Tablet Pro Windows 8.1 Pro Win64
Desktop PC (HP) Windows 7 Ent. Win32
Desktop PC (iMac) OSX 10.8.5 MacIntel
回答by justin
I could not post a comment, so I leave these ones I think are not mentioned above:
我无法发表评论,所以我留下这些我认为上面没有提到的:
+-----+--------------+--------------------------------------+
| iid | item | value |
+-----+--------------+--------------------------------------+
| 448 | nav_platform | Linux armv7l |
| 454 | nav_platform | ARM |
| 455 | nav_platform | Linux x86_64 |
| 457 | nav_platform | PlayStation 4 |
| 459 | nav_platform | masking-agent |
| 460 | nav_platform | OpenBSD amd64 |
| 464 | nav_platform | FreeBSD amd64 |
| 465 | nav_platform | Linux armv5tejl |
| 466 | nav_platform | Symbian OS |
| 467 | nav_platform | New Nintendo 3DS |
| 470 | nav_platform | Linux armv6l |
| 471 | nav_platform | FreeBSD |
| 472 | nav_platform | Symbian |
| 473 | nav_platform | Linux MSM8960_V3.2.1.1_N_R069_Rev:18 |
| 476 | nav_platform | Linux aarch64 |
| 479 | nav_platform | Linux i686 on x86_64 |
| 480 | nav_platform | Linux ppc64 |
+-----+--------------+--------------------------------------+
"masking-agent" is a browser privacy extension that changes the platform by default to that.
“masking-agent”是一个浏览器隐私扩展,默认情况下会将平台更改为该平台。
The weird long one is a Sony Z10
奇怪的长的是索尼Z10