对ie浏览器版本识别的js代码

对ie浏览器版本识别的js代码

// 判断是pc端还是还是手机 

var theUA = window.navigator.userAgent.toLowerCase();

// 识别ie的

  var theIE = navigator.userAgent.toLowerCase().match(/rv:([\d.]+)\) like gecko/)

// 对于是否是ie浏览器的判断

if(!+[1,]){
alert("这是ie浏览器")
}else{
alert("这不是ie浏览器");
} 

// 实现检测IE浏览器版本ie10以及ie11版本的浏览器页面,版本太低给出提示,在index.heml里面的head添加

<script>
    function getVendorPrefix() {
      // 使用body是为了避免在还需要传入元素
      var body = document.body || document.documentElement,
          style = body.style,
          vendor = ['webkit', 'khtml', 'moz', 'ms', 'o'],
          i = 0;
      while (i < vendor.length) {
        // 此处进行判断是否有对应的内核前缀
        if (typeof style[vendor[i] + 'Transition'] === 'string') {
          return vendor[i];
        }
        i++;
      }
    }
    if(getVendorPrefix()!='webkit'){
      var str = "你的浏览器版本不适合本系统,请更换合适的浏览器版本!";
          var str2 = "推荐使用:<a href='https://www.baidu.com/s?ie=UTF-8&wd=%E8%B0%B7%E6%AD%8C%E6%B5%8F%E8%A7%88%E5%99%A8' target='_blank' style='color:blue;'>谷歌</a>,"
            + "其他双核极速模式";
          document.writeln("<pre style='text-align:center;color:#fff;background-color:cornflowerblue; height:100%;border:0;position:fixed;top:0;left:0;width:100%;z-index:1234'>" +
            "<h2 style='padding-top:200px;margin:0'><strong>" + str + "<br/></strong></h2><h2>" +
            str2 + "</h2><h2 style='margin:0'><strong>如果你的使用的是双核浏览器,请切换到极速模式访问<br/></strong></h2></pre>");
          document.execCommand("Stop");
    //  window.location.href("http://www3.firstjob.com.cn/pros/jr/index.jsp")
     
  }
  </script>


 

代码段 小部件
[Dàimǎ duàn xiǎo bùjiàn]
 
Code segment widget
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值