Created
April 28, 2016 17:23
-
-
Save huyinghuan/b920c44e255516e4e358a25601ce4e6e to your computer and use it in GitHub Desktop.
判断IE版本
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
var isIE = function(verArr){ | |
var b = document.createElement('b'); | |
if(!verArr){ | |
b.innerHTML = '<!--[if IE]><i></i><![endif]-->'; | |
return b.getElementsByTagName('i').length === 1 | |
} | |
for(var i = 0, len = verArr; i < len; i++){ | |
b.innerHTML = '<!--[if IE ' + verArr[i] + ']><i></i><![endif]-->' | |
if(b.getElementsByTagName('i').length === 1){ | |
return true | |
} | |
} | |
return false | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment