JS代码:
function getType()
{
if(navigator.userAgent.indexOf("MSIE")>0) {
return "MSIE";
}
if(navigator.userAgent.indexOf("Firefox")>0){
return "Firefox";
}
if(navigator.userAgent.indexOf("Opera")>0){
return "Opera";
}
if(navigator.userAgent.indexOf("Safari")>0) {
return "Safari";
}
if(navigator.userAgent.indexOf("Camino")>0){
return "Camino";
}
if(navigator.userAgent.indexOf("Gecko")>0){
return "Gecko";
}
}
补充:
JS获取浏览器相关信息:
1. 浏览器代码名称:navigator.appCodeName文章地址https://www.yii666.com/article/756340.html
2. 浏览器名称:navigator.appName
3. 浏览器版本号:navigator.appVersion
4. 对Java的支持:navigator.javaEnabled()
5. MIME类型(数组):navigator.mimeTypes
6. 系统平台:navigator.platform文章来源地址:https://www.yii666.com/article/756340.html
7. 插件(数组):navigator.plugins
8. 用户代理:navigator.userAgent
网址:yii666.com