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="其他";
}
}
}
console.log("客户端浏览器是:"+ myexplorer());