View Full Version : getting information of user's operating system

Dec 17th, 2006, 01:58 PM
I like to get the information about user's operating system.

Can I know whether the user's O/S is Window, Linux or something in javascript?

Dec 17th, 2006, 04:01 PM
try this

var OSName="Unknown OS";
if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";

document.write('Your OS: '+OSName);