zoukankan      html  css  js  c++  java
  • ie11浏览器版本不识别

    //判断浏览器版本
    function CheckBrowser() {
        
        var sys = {};
        var ua = navigator.userAgent.toLowerCase();
        if (ua.match(/msie/) != null || ua.match(/trident/) != null) {
           
            //哈哈,现在可以检测ie11.0了!
            var BrowserVersion = ua.match(/msie ([\d.]+)/) != null ? ua.match(/msie ([\d.]+)/)[1] : ua.match(/rv:([\d.]+)/)[1];
            alert("IE:"+BrowserVersion);
        }
        else {
            var s;
            (s = ua.match(/firefox\/([\d.]+)/)) ? sys.firefox = s[1] :
            (s = ua.match(/chrome\/([\d.]+)/)) ? sys.chrome = s[1] :
            (s = ua.match(/opera.([\d.]+)/)) ? sys.opera = s[1] :
            (s = ua.match(/version\/([\d.]+).*safari/)) ? sys.safari = s[1] : 0;
            //以下进行测试
            if (sys.firefox) {
                alert('Firefox' + sys.firefox);
            }
            if (sys.chrome) {
                alert('Chrome' + sys.chrome);
            }
            if (sys.opera) {
                alert('Opera' + sys.opera);
            }
            if (sys.safari) {
                alert('Safari' + sys.safari);
            }
        }
       
    }
    
  • 相关阅读:
    Date计算人活了多少天
    微信红包平均分法
    math practise
    Array sort
    static memory management
    java数组中的选择排序
    java数组中的冒泡排序
    数组联系2 模拟酒店系统
    数组练习1(模拟栈)
    二维数组
  • 原文地址:https://www.cnblogs.com/streamice/p/browser.html
Copyright © 2011-2022 走看看