Created
September 11, 2012 08:04
-
-
Save batako/3696801 to your computer and use it in GitHub Desktop.
ブラウザ判定
This file contains hidden or 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
function BROWSER(){ | |
var userAgent = window.navigator.userAgent.toLowerCase(); | |
var appVersion = window.navigator.appVersion.toLowerCase(); | |
var BROWSER; | |
if (userAgent.indexOf("msie") > -1) { | |
if (appVersion.indexOf("msie 6.0") > -1) { | |
BROWSER = "IE6"; | |
} | |
else if (appVersion.indexOf("msie 7.0") > -1) { | |
BROWSER = "IE7"; | |
} | |
else if (appVersion.indexOf("msie 8.0") > -1) { | |
BROWSER = "IE8"; | |
} | |
else if (appVersion.indexOf("msie 9.0") > -1) { | |
BROWSER = "IE9"; | |
} | |
else { | |
BROWSER = "IE?"; | |
} | |
} | |
else if (userAgent.indexOf("firefox") > -1) { | |
BROWSER = "Firefox"; | |
} | |
else if (userAgent.indexOf("opera") > -1) { | |
BROWSER = "Opera"; | |
} | |
else if (userAgent.indexOf("chrome") > -1) { | |
BROWSER = "Google Chrome"; | |
} | |
else if (userAgent.indexOf("safari") > -1) { | |
BROWSER = "Safari"; | |
} | |
else { | |
BROWSER = "Unknown"; | |
} | |
return(BROWSER); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment