原生JS检测IE版本

来源:互联网 发布:北京交通大学知行 编辑:程序博客网 时间:2024/06/06 12:59
IE的BUG实在太多了,所以有时候要检测IE的版本。所以写了个函数,只是检测IE的,其他浏览器下面返回null
//检测IE版本
function cheackIE(){
var appName = navigator.appName,
userAgent = navigator.userAgent,
version;
if(appName == ''Microsoft Internet Explorer''){
version = /MSIEs(S)/.exec(userAgent)[1];
versionfloat = parseFloat(version);
return versionfloat;
}
return null;
}

经检测是可以用的。
原创粉丝点击