Skip to content

Instantly share code, notes, and snippets.

@gregorynicholas
Created May 5, 2011 21:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregorynicholas/957967 to your computer and use it in GitHub Desktop.
Save gregorynicholas/957967 to your computer and use it in GitHub Desktop.
Simple Browser Detection Function
function detect_browser() {
var browserName = navigator.appName;
var browserVer = parseInt(navigator.appVersion, 10);
if (browserName === "Netscape" && browserVer >= 3) browserVer = "1";
else if (browserName === "Microsoft Internet Explorer" && browserVer === 4) browserVer = "1";
else browserVer = "2";
return { name: browserName, version: browerVer };
}
@solsolomon
Copy link

var browserName

@gregorynicholas
Copy link
Author

@solsolomon you're write..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment