Using Javascript to Detect OS
Detect OSX or Windows with Javascript
We can easily detect whether client’s machine is PC or Mac with Javascript.
We can just analyze the value of navigator.appVersion or navigator.userAgent. Be careful, some clients will spoof the userAgent.
// Javascript code for OSX or Windows detection var OSName="Unknown OS"; if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows"; if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS"; document.write('Your OS: '+OSName);