zoukankan      html  css  js  c++  java
  • 判断IE浏览器的类型以及提示信息(低版本浏览器不予显示)

    //浏览器IE版本判断
    (function(window) {
        var theUA = window.navigator.userAgent.toLowerCase();
        if ((theUA.match(/msiesd+/) && theUA.match(/msiesd+/)[0]) || (theUA.match(/tridents?d+/) && theUA.match(/tridents?d+/)[0])) {
            var ieVersion = theUA.match(/msiesd+/)[0].match(/d+/)[0] || theUA.match(/tridents?d+/)[0];
            if (ieVersion < 9) {
                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>,"
                    + "<a href='https://www.baidu.com/s?ie=UTF-8&wd=%E7%81%AB%E7%8B%90%E6%B5%8F%E8%A7%88%E5%99%A8' target='_blank' style='color:blue;'>火狐</a>,"  + "<a href='https://www.baidu.com/s?ie=utf-8&f=3&rsv_bp=1&tn=baidu&wd=IE11%E6%B5%8F%E8%A7%88%E5%99%A8&oq=%25E8%25B0%25B7%25E6%25AD%258C%25E6%25B5%258F%25E8%25A7%2588%25E5%2599%25A8&rsv_pq=b8d4119a000161bd&rsv_t=0381F7aojF2j91S6s6MfveyLP4BVXVQe7l814Y8JTEWpexCGFl94WjX9F7s&rqlang=cn&rsv_enter=0&rsv_sug3=12&rsv_sug1=9&rsv_sug7=100&prefixsug=I%2526gt%253B11%25E6%25B5%258F%25E8%25A7%2588%25E5%2599%25A8&rsp=3&inputT=19433&rsv_sug4=19435' target='_blank' style='color:blue;'>IE</a>,"
                    + "其他双核极速模式";
                document.writeln("<pre style='text-align:center;color:red;background-color:#ccc; height:100%;border:0;position:fixed;top:0;left:0;100%;z-index:1234'>" +
                    "<h2 style='padding-top:200px;margin:0'><strong>" + str + "<br/></strong></h2><h2>" +
                    str2 + "</h2><h2 style='margin:0'><strong>如果你的使用的是IE浏览器,请升级到IE9及以上版本<br/></strong></h2></pre>");
                document.execCommand("Stop");
            };
        }
    })(window);

  • 相关阅读:
    shell80set变量
    shell79控制多进程的数量
    shell78管道
    sina sae开发中出现的问题
    html中代码高亮显示
    handlebars模板替换
    打印目录下所有的文件名(包含深层次目录)
    input为disabled提交后得不到该值的解决方法
    Global和Globals
    js算法运算
  • 原文地址:https://www.cnblogs.com/supershare/p/7473765.html
Copyright © 2011-2022 走看看