zoukankan      html  css  js  c++  java
  • js判定是否为chrome,区分搜狗+360

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Document</title>
    <meta name="renderer" content="ie-comp"></head>
    <body>
     
    <script>
    function myexplorer(){
    var explorer = window.navigator.userAgent;
    if (explorer.indexOf("QQBrowser")>=0 || explorer.indexOf("QQ")>=0){
        return myexplorer="腾讯QQ";
    }
    else if(explorer.indexOf("Safari")>=0 && explorer.indexOf("MetaSr")>=0){
        return myexplorer="搜狗";
    }
    else if (!!window.ActiveXObject || "ActiveXObject" in window){//IE
    if (!window.XMLHttpRequest){
        return myexplorer="IE6";
    }
    else if (window.XMLHttpRequest && !document.documentMode){
        return myexplorer="IE7";
    }
    else if (!-[1,] && document.documentMode && !("msDoNotTrack" in window.navigator)){
        return myexplorer="IE8";
    }
    else{//IE9 10 11
    var hasStrictMode=(function(){"use strict";return this===undefined;}());
    if (hasStrictMode){
    if (!!window.attachEvent){return myexplorer="IE10";}else{return myexplorer="IE11";}
    }
    else{
    return myexplorer="IE9";
    }
    }
    }else{//非IE
    if (explorer.indexOf("LBBROWSER") >= 0){return myexplorer="猎豹";
    }else if(explorer.indexOf("Firefox")>=0){return myexplorer="火狐";
    }else if(explorer.indexOf("Maxthon")>=0){return myexplorer="遨游";
    }else if(explorer.indexOf("Chrome")>=0){return myexplorer="谷歌";
    }else if(explorer.indexOf("Opera")>=0){return myexplorer="欧朋";
    }else if (explorer.indexOf("TheWorld") >= 0){return myexplorer="世界之窗";
    }else if(explorer.indexOf("Safari")>=0){return myexplorer="苹果";
    }else{return myexplorer="其他";
    }
    }
    }
    document.write("客户端浏览器是:"+myexplorer());
     
     
     
     
     
     
     
     
     
    </script>
    </body>
    </html>
  • 相关阅读:
    Saltstack cmd.run 多项命令
    salt state.sls windows 传输文件
    mysql 时区更改;5.7 弱口令
    nginx 端口转发
    nohup 后台执行
    检测 nginx 关闭切换keepalived
    Centos 7 安装 dotnet 环境
    unison 双向镜像同步
    samba 配置参数详解
    数据结构与算法面试题80道(15)
  • 原文地址:https://www.cnblogs.com/jldiary/p/5317200.html
Copyright © 2011-2022 走看看