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>
上一篇:SQLServer .mdf和.ldf文件


下一篇:重磅 | 阿里云与MongoDB达成战略合作,成为全球唯一提供最新版MongoDB的云厂商