function checkBrowser() {
var browserName = navigator.userAgent.toLowerCase();
//var ua = navigator.userAgent.toLowerCase();
var Sys = {};
var rtn = false;
if (/msie/i.test(browserName) && !/opera/.test(browserName)) {
strBrowser = "IE: " + browserName.match(/msie ([\d.]+)/)[1];
rtn = true;
alert('我是IE');
//return true;
} else if (/firefox/i.test(browserName)) {
strBrowser = "Firefox: " + browserName.match(/firefox\/([\d.]+)/)[1];
alert('我是火狐');
//return false;
} else if (/chrome/i.test(browserName) && /webkit/i.test(browserName) && /mozilla/i.test(browserName)) {
strBrowser = "Chrome: " + browserName.match(/chrome\/([\d.]+)/)[1];
alert('我是谷歌');
//return false;
} else if (/opera/i.test(browserName)) {
strBrowser = "Opera: " + browserName.match(/opera.([\d.]+)/)[1];
//return false;
} else if (/webkit/i.test(browserName) && !(/chrome/i.test(browserName) && /webkit/i.test(browserName) && /mozilla/i.test(browserName))) {
strBrowser = "Safari: ";
//return false;
} else {
strBrowser = "unKnow,未知浏览器 ";
//return false;
}
strBrowser = "您当前使用的浏览器是:" + strBrowser;
//alert(strBrowser)
return rtn;
}
checkBrowser();