Created
January 4, 2014 01:34
-
-
Save wangwen1220/8250306 to your computer and use it in GitHub Desktop.
JS: 检测浏览器 | test browser
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
/* IE 6 */ | |
(checkIE = document.createElement("b")).innerHTML = "<!--[if IE 6]><i></i><![endif]-->"; | |
var isIE = checkIE.getElementsByTagName("i").length == 1; | |
/* IE 7 */ | |
(checkIE = document.createElement("b")).innerHTML = "<!--[if IE 7]><i></i><![endif]-->"; | |
var isIE = checkIE.getElementsByTagName("i").length == 1; | |
navigator.appVersion.indexOf("MSIE 7.")!=-1 | |
/* IE 8 */ | |
(checkIE = document.createElement("b")).innerHTML = "<!--[if IE 8]><i></i><![endif]-->"; | |
var isIE = checkIE.getElementsByTagName("i").length == 1; | |
/* IE 9 */ | |
(checkIE = document.createElement("b")).innerHTML = "<!--[if IE 9]><i></i><![endif]-->"; | |
var isIE = checkIE.getElementsByTagName("i").length == 1; | |
/* IE 10 */ | |
var isIE = eval("/*@cc_on!@*/false") && document.documentMode === 10; | |
/* IE 10 */ | |
var isIE = document.body.style.msTouchAction != undefined; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment