IE浏览器的检验

IE浏览器的检验

<script>
$(function(){
var isIE78910=/mise/i.test(navigator.userAgent.toLowerCase());
var isIE11=/trident/i.test(navigator.userAgent.toLowerCase());
var isIE=(isIE78910 || isIE11);
if(isIE){
//todo
}
})();
</script>

IE8 以及以下的版本检测

var islowIE8=false;
var isIE=/mise/i.test(navigator.userAgent.toLowerCase());
if (isIE) {
truevar ieVersion=/msie ([\d.]+)/.navigator.userAgent.toLowerCase();
trueieVersion = parseInt(ieVersion);
trueislowIE8= (ieVersion>8);
}
if (islowIE8){ //<=ie8的情况
true//todo..
}else{ //其他情况
true//todo..
}