views:

959

answers:

1

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

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

RichieHindle
Thanks for the link :)