zoukankan      html  css  js  c++  java
  • jquery 1.9 1.8 判断 浏览器(IE11,IE8,IE7,IE6)版本

    1.9以后很我方法删除了,所有和之前版本判断浏览器版本有所差记录一下

    1.9

    ----------------------------------------------------------------------------------------------

    if (/msie/.test(navigator.userAgent.toLowerCase())) {
                //IE6
                if ('undefined' == typeof (document.body.style.maxHeight)) {
                    $('#toolInfo').show();
                } else {
                    //IE6-8
                    //if (!$.support.leadingWhitespace) {
                    //    $('#toolInfo').show();
                    //}
                    var ua1 = navigator.userAgent.toLowerCase();
                    if (ua1.match(/msie/) != null || ua1.match(/trident/) != null) {
                        //浏览器类型  
                        var browserType1 = "IE";
                        //浏览器版本  
                        var browserVersion1 = ua1.match(/msie ([d.]+)/) != null ? ua1.match(/msie ([d.]+)/)[1] : ua1.match(/rv:([d.]+)/)[1];
                        if (browserVersion1.indexOf('7') > -1) {
                            $('#toolInfo').show();
                        }
                    }
                }
            }
            else if (/firefox/.test(navigator.userAgent.toLowerCase())||
                /webkit/.test(navigator.userAgent.toLowerCase())||
                /opera/.test(navigator.userAgent.toLowerCase())) {
                //(当是火狐的时候)不显示(因为IE11采用的是火狐的内核)
                $('#toolInfo').show();
            }
            else {
                //IE11
                var ua = navigator.userAgent.toLowerCase();
                if (ua.match(/msie/) != null || ua.match(/trident/) != null) {
                    //浏览器类型  
                    var browserType = "IE";
                    //浏览器版本  
                    var browserVersion = ua.match(/msie ([d.]+)/) != null ? ua.match(/msie ([d.]+)/)[1] : ua.match(/rv:([d.]+)/)[1];
    
                } else {
                    $('#toolInfo').show();
                }
            }

    1.8.3

    ------------------------------------------------------------------------------------------------------------------------------

    //当前如果不是IE浏览器或IE版本低于IE8的都要给出系统不支持的提示,并且给出下载安装包
            if ($.browser.msie) {
                if (parseFloat($.browser.version) < 8) {
                    $('#toolInfo').show();
                }
            }
            else if ($.browser.mozilla) {
                //(当是火狐的时候)不显示(因为IE11采用的是火狐的内核)
            }
            else {
                $('#toolInfo').show();
            }

    代码有点乱,

  • 相关阅读:
    eolinker使用初体验(一)
    微信小程序--地图组件与api-模拟器上返回的scale 与真机上不同--bindregionchange触发图标一直闪现问题
    wx.createSelectorQuery() 获取节点信息 获取不到解决方法
    各种兼容
    跨域
    判断为false的情况
    linux的ssh相关指令
    js用正则表达式将英文引号字符替换为中文引号字符
    JavaScript控制iframe中元素的样式
    jQuery匹配id 批量修改css属性
  • 原文地址:https://www.cnblogs.com/xiaoruilin/p/5726419.html
Copyright © 2011-2022 走看看