用途:区分当前IE浏览器系列中(IE8还是IE11)
1:先判断是否为IE浏览器(IE8和IE11,适用)
function isIE(){
if(window.showModalDialog){
return true;
}
return false;
}
2:再判断版本号
function isIE11(){
var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
if(isIE11){
return true;
}
return false;
}