判断浏览器是否是ie8 兼容ie8

原创
2017/06/22 16:39
阅读数 456
window.onload=function(){
    var browser = navigator.appName;
    var b_version = navigator.appVersion;
    var version = b_version.split(";");
    var trim_Version = version[1].replace(/[ ]/g,"");
    // var trim_Version
    // if (version[1])trim_Version = version[1].replace(/[ ]/g,"");
    if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE8.0") {
      console.log('ie8');
    }else{
       console.log('ie8+');
    }
};



//基于jquery
$(function(){
    var browser = navigator.appName; 
    var b_version = navigator.appVersion; 
    var version = b_version.split(";"); 
    // var trim_Version 
    // if (version[1])trim_Version = version[1].replace(/[ ]/g,"");
     var trim_Version = version[1].replace(/[ ]/g,""); 
    if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE8.0") {
         console.log('ie8');
     }else{
         console.log('ie8+');
     }
});
展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
0 评论
0 收藏
0
分享
返回顶部
顶部