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();
            }

    代码有点乱,

  • 相关阅读:
    015.Python函数名的使用以及函数变量的操作
    014.Python函数
    013.Python的文件操作
    012.Python的字典和集合的相关函数
    git入门
    Visual Studio 常见的快捷键
    SVN使用
    C++ 一些特性
    C++ 引用、构造函数、移动语义
    WPF的AutoCompleteBox控件
  • 原文地址:https://www.cnblogs.com/xiaoruilin/p/5726419.html
Copyright © 2011-2022 走看看