Thursday, April 14, 2011

Javascript Get browser\OS version

*** browser\other version ***



Ref: http://www.webdeveloper.com/forum/archive/index.php/t-127667.html

*** OS version ***

// This script sets OSName variable as follows:
// "Windows" for all versions of Windows
// "MacOS" for all versions of Macintosh OS
// "Linux" for all versions of Linux
// "UNIX" for all other UNIX flavors
// "Unknown OS" indicates failure to detect the OS

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);

Ref: http://www.javascripter.net/faq/operatin.htm

Others: https://developer.mozilla.org/En/Browser_Detection_and_Cross_Browser_Support

No comments:

Post a Comment