JavaScript OS Detection - several Windows XP versi

2019-06-11 12:51发布

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条回答
劳资没心,怎么记你
2楼-- · 2019-06-11 13:32

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

查看更多
登录 后发表回答