Created
November 14, 2012 18:12
-
-
Save steveosoule/4073759 to your computer and use it in GitHub Desktop.
JavaScript Browser Info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JavaScript Document// Example: | |
// var b = new BrowserInfo(); | |
// alert(b.version); | |
function BrowserInfo(){ | |
this.name = navigator.appName; | |
this.codename = navigator.appCodeName; | |
this.version = navigator.appVersion.substring(0, 4); | |
this.platform = navigator.platform; | |
this.javaEnabled = navigator.javaEnabled(); | |
this.screenWidth = screen.width; | |
this.screenHeight = screen.height; | |
alert(this.name); | |
} | |
function platformDetect(){ | |
if(navigator.appVersion.indexOf("Win") != -1){ | |
alert("Windows"); | |
} | |
else if(navigator.appVersion.indexOf("Mac") != -1){ | |
alert("Macintosh"); | |
} | |
else alert("Other"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment