Detect operating system user side in javascript


// 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=”win_styles”;
document.write(”);
}
if (navigator.appVersion.indexOf(“Mac”)!=-1){
OSName=”mac_styles”;
document.write(”);
}
/*if (navigator.appVersion.indexOf(“X11″)!=-1){
OSName=”UNIX”;
}
if (navigator.appVersion.indexOf(“Linux”)!=-1){
OSName=”Linux”;
}*/

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: