JavaScript OS Detection - several Windows XP versions?

不问归期 提交于 2019-12-08 12:11:13

问题


I am trying to detect three operating systems - Windows XP, Windows Vista, Linux.

I use the navigator.oscpu which alerts the following OS/values -

Windows XP SP3 - Windows NT 5.1

Windows Vista - Windows NT 6.0

Ubuntu 9.04 - Linux i686

I am doubtful about the number 5.1 shown for XP. Will it show 5.1 for ALL configurations or XP - (without SP2, With SP2, With SP3) ??

Is there any chance for it to show Windows NT 5.0 for Windows XP in pre-SP2 or pre-SP3 configurations?

Bottom line is - does Windows XP mean 5.1 only or any 5.x version?

If there is a better way to definitively distinguish between the three operating systems, it will be great.

Note: This is for a Firefox extension. So, cross browser compatibility of the JavaScript code is not an issue. Please don't bring up this won't work in IE stuff.


回答1:


Windows 5.1 is XP 32-bit, for any service pack.

Windows 2000:      5.0
Windows XP:        5.1
Windows XP 64-bit: 5.2
Windows Vista:     6.0
Windows 7:         6.1

There's a table of all the version numbers here: Microsoft Windows / Timeline of releases



来源:https://stackoverflow.com/questions/1310731/javascript-os-detection-several-windows-xp-versions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!