判断是否ie10及以下

2020-06-22  本文已影响0人  请叫我彭彭
  var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串  
        var isIE = userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1; //判断是否IE<11浏览器  
        if (isIE) {
            var str1 = '你的ie浏览器版本不能低于11';
            var str2 = '推荐使用:<a href="https://www.google.cn/intl/zh-CN/chrome/" target="_blank" style="color:blue;">谷歌</a>,' +
                '<a href="http://www.firefox.com.cn/"" target="_blank" style="color:blue;">火狐</a>或其他双核极速模式';
            document.writeln("<pre style='text-align:center;color:#fff;background-color:#0cc; height:100%;border:0;position:fixed;top:0;left:0;width:100%;z-index:1234'>" +
                "<p style='padding-top:200px;margin:0'><strong>" + str1 + "<br/></strong></p><p style='margin-top:10px;'>" +
                str2 + "</p><p style='margin:10px;'><strong>如果你的使用的是双核浏览器,请切换到极速模式访问<br/></strong></p></pre>");
            document.execCommand("Stop");
        }
上一篇下一篇

猜你喜欢

热点阅读