Skip to content

Instantly share code, notes, and snippets.

@justinobney
Created February 20, 2013 19:24
Show Gist options
  • Save justinobney/4998441 to your computer and use it in GitHub Desktop.
Save justinobney/4998441 to your computer and use it in GitHub Desktop.
function DetectOS() {
var osName = "Unknown OS";
var platform = navigator.platform.toUpperCase();
if (platform.indexOf("WIN") != -1) osName = "Windows";
if (platform.indexOf('MAC') != -1) osName = "MacOS";
if (platform.indexOf("X11") != -1) osName = "UNIX";
if (platform.indexOf("LINUX") != -1) osName = "Linux";
return osName;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment