日期:2014-05-17 浏览次数:20682 次
var br = navigator.userAgent.toLowerCase();
var browserVer = (br.match(/.+(?:rv
------解决方案--------------------
it
------解决方案--------------------
ra
------解决方案--------------------
ie)[\/: ]([\d.]+)/)
------解决方案--------------------
[0, '0'])[1];
var brower = userBrowser();//得到浏览器名称
alert("版本号:"+browserVer);
alert("浏览器:"+brower );
//2、js浏览器判断函数
function userBrowser() {
var browserName = navigator.userAgent.toLowerCase();
if (/msie/i.test(browserName) && !/opera/.test(browserName)) {
return "IE";
} else if (/firefox/i.test(browserName)) {
return "Firefox";
} else if (/chrome/i.test(browserName) && /webkit/i.test(browserName) && /mozilla/i.test(browserName)) {
return "Chrome";
} else if (/opera/i.test(browserName)) {
return "Opera";
} else if (/webkit/i.test(browserName) && !(/chrome/i.test(browserName) && /webkit/i.test(browserName) && /mozilla/i.test(browserName))) {
return "Safari";
} else {
return "unKnow";
}
}