I have been writing a userscript for the past few months, for my company, and have just designed the main site for it with installation instructions (our employees are based
The Stack Overflow question Detect exact OS version from browser goes into some interesting detail about getting the OS version from the User-Agent header which I believe contains the same information that can be accessed from JavaScript.
You can use this great javascript library: http://www.visitorjs.com/details It is open-sourced recently
Edit: Actually, it is now renamed to session.js http://github.com/codejoust/session.js and to my knowledge, that is the best you can get.
Your best bet is to use the navigator.userAgent property. It will give the windows version number. You can see a table of how the Windows version number map to the OS here:
OSVERSIONINFO
Here is some example detection code:
var os = (function() {
var ua = navigator.userAgent.toLowerCase();
return {
isWin2K: /windows nt 5.0/.test(ua),
isXP: /windows nt 5.1/.test(ua),
isVista: /windows nt 6.0/.test(ua),
isWin7: /windows nt 6.1/.test(ua),
isWin8: /windows nt 6.2/.test(ua),
isWin81: /windows nt 6.3/.test(ua)
};
}());
if(os.isWin7) {
...
}
http://jsfiddle.net/45jEc/