判断浏览器browser类型
用法:
if (!browserType('firefox') && !browserType('chrome') && !browserType('safari')) {
alert('请使用Firefox、Safari或Chrome浏览器!');
}
JS代码:
//判断浏览器
function browserType(obj) {//obj小写
var result = false,
ua = navigator.userAgent.toLowerCase();
result = ua.indexOf(obj) > -1 ? true : false;
return result;
}