js怎么判断浏览器类型

<script type=“text/javascript”>

function isIE(){
return navigator.appName.indexOf(“Microsoft Internet Explorer”)!=-1 && document.all;
}

function isIE6() {
return navigator.userAgent.split(“;”)[1].toLowerCase().indexOf(“msie 6.0″)==“-1″?false:true;
}

function isIE7(){
return navigator.userAgent.split(“;”)[1].toLowerCase().indexOf(“msie 7.0″)==“-1″?false:true;
}

function isIE8(){
return navigator.userAgent.split(“;”)[1].toLowerCase().indexOf(“msie 8.0″)==“-1″?false:true;
}

function isNN(){
return navigator.userAgent.indexOf(“Netscape”)!=-1;
}

function isOpera(){
return navigator.appName.indexOf(“Opera”)!=-1;
}

function isFF(){
return navigator.userAgent.indexOf(“Firefox”)!=-1;
}

function isChrome(){
return navigator.userAgent.indexOf(“Chrome”) > -1;
}
</script>

下面介绍下 js获取客户端浏览器信息

Navigator 对象包含有关浏览器的信息。js就是通过Navigator的属性获取客户端浏览器信息
Navigator 对象属性:

属性
描述

appCodeName 返回浏览器的代码名。
appMinorVersion 返回浏览器的次级版本。
appName 返回浏览器的名称。
appVersion 返回浏览器的平台和版本信息。
browserLanguage 返回当前浏览器的语言。
cookieEnabled 返回指明浏览器中是否启用 cookie 的布尔值。
cpuClass 返回浏览器系统的 CPU 等级。
onLine 返回指明系统是否处于脱机模式的布尔值。
platform 返回运行浏览器的操作系统平台。
systemLanguage 返回 OS 使用的默认语言。
userAgent 返回由客户机发送服务器的 user-agent 头部的值。
userLanguage 返回 OS 的自然语言设置。
posted @ 2014-06-03 03:06  renyangli  阅读(858)  评论(0编辑  收藏  举报