zoukankan      html  css  js  c++  java
  • 判断IE和360浏览器

    var check = function(r) {
    return r.test(navigator.userAgent.toLowerCase());
    };
    var statics = {
    /**
    * 是否为webkit内核的浏览器
    */
    isWebkit: function() {
    return check(/webkit/);
    },
    /**
    * 是否为火狐浏览器
    */
    isFirefox: function() {
    return check(/firefox/);
    },
    /**
    * 是否为谷歌浏览器
    */
    isChrome: function() {
    return !statics.isOpera() && check(/chrome/);
    },
    /**
    * 是否为Opera浏览器
    */
    isOpera: function() {
    return check(/opr/);
    },
    /**
    * 检测是否为Safari浏览器
    */
    isSafari: function() {
    // google chrome浏览器中也包含了safari
    return !statics.isChrome() && !statics.isOpera() && check(/safari/);
    }
    };

    //判断是否是ie浏览器和360浏览器
    (function(window) {
    var ms_ie = false;
    var ua = window.navigator.userAgent.toLowerCase();
    // alert(ua);
    // var ua = navigator.userAgent.toLowerCase();
    var old_ie = ua.indexOf('MSIE');
    var new_ie = ua.indexOf('trident/');
    var is360 = false;
    var append = document.getElementById("append");
    if((old_ie > -1) || (new_ie > -1)) {
    ms_ie = true;
    }
    // alert(old_ie> -1);
    // alert(new_ie > -1);
    if(window.navigator.appName.indexOf("Microsoft") != -1) {
    me_ie = true;
    }

    if((window.navigator.mimeTypes[40] || !window.navigator.mimeTypes.length)) {
    is360 = true;
    }

    if(ms_ie) {
    document.documentElement.className += "ie";
    append.style.display = "block";
    } else {
    append.style.display = "none";
    }

    })(window);

  • 相关阅读:
    POJ 1680 Fork() Makes Trouble
    课堂改进意见
    梦断代码 读后感3
    梦断代码 读后感2
    找一问题
    软件评价——搜狗输入法
    《梦断代码》读后感1
    站立会议第十天
    站立会议第九天
    站立会议第八天
  • 原文地址:https://www.cnblogs.com/lxk0301/p/6475270.html
Copyright © 2011-2022 走看看