B = (function(ua){
var b = {
msie : /msie/.test(ua) && !/opera/.test(ua),
opera : /opera/.test(ua),
safari : /webkit/.test(ua) && !/chrome/.test(ua),
firefox : /firefox/.test(ua),
chrome : /chrome/.test(ua)
};
var vMark = "";
for(var i in b){
if(b[i]){
vMark = "safari" == i ? "version" : i;
break;
}
}
b.version = vMark && RegExp("(?:" + vMark + ")[\\/: ]([\\d.]+)").test(ua) ? RegExp.$1 : "0";
b.ie = b.msie;
b.ie6 = b.msie && parseInt(b.version, 10) == 6;
b.ie7 = b.msie && parseInt(b.version, 10) == 7;
b.ie8 = b.msie && parseInt(b.version, 10) == 8;
b.ie9 = b.msie && parseInt(b.version, 10) == 9;
return b;
})(window.navigator.userAgent.toLowerCase());
浏览器判断
最新推荐文章于 2022-03-16 15:57:16 发布