验证中...
浏览器userAgent检测
Raw Copy
function getExplorerInfo() {
var explorer = window.navigator.userAgent.toLowerCase(), ver = '';
//ie
if (explorer.indexOf("msie") >= 0) {
ver = explorer.match(/msie ([\d.]+)/)[1];
return {type: "ie", version: ver};
}
if (explorer.indexOf("tablet") >= 0) {
return {type: "ie", version: '11'};
}
//firefox
else if (explorer.indexOf("firefox") >= 0) {
ver = explorer.match(/firefox\/([\d.]+)/)[1];
return {type: "firefox", version: ver};
}
//Chrome
else if (explorer.indexOf("chrome") >= 0) {
ver = explorer.match(/chrome\/([\d.]+)/)[1];
return {type: "chrome", version: ver};
}
//Opera
else if (explorer.indexOf("opera") >= 0) {
ver = explorer.match(/opera.([\d.]+)/)[1];
return {type: "opera", version: ver};
}
//Safari
else if (explorer.indexOf("safari") >= 0) {
ver = explorer.match(/version\/([\d.]+)/)[1];
return {type: "safari", version: ver};
}
}

Comment list( 0 )

You need to Sign in for post a comment

Help Search