Mr. Lavalamp
Mr. Lavalamp

Reputation: 1888

Detecting OS (XP vs 7)

Yes, I've heard a million times that there is no reason to want to detect OS, but I'm getting different behaviors on both Firefox and Chrome between Windows XP and the exact same browser version on Windows 7. I've scoured the internet and turned up nothing that can do anything more than detect whether or not it is Windows.

I also can't find any information on whether there may be a feature difference between the XP/7 versions of the browser. Any help would be -greatly- appreciated, as I'm really at wit's end with this one. Thanks!

Upvotes: 2

Views: 3218

Answers (1)

dersvenhesse
dersvenhesse

Reputation: 6414

You can use navigator.userAgent. In XP it contains 5.1, in Vista 6.0 and in Windows 7 6.1 as you can see here http://msdn.microsoft.com/en-us/library/windows/desktop/ms724834(v=vs.85).aspx.

var ua = navigator.userAgent.toLowerCase();
var isWinXP = ua.indexOf('windows nt 5.1') > 0;    

Upvotes: 5

Related Questions