当前位置:编程学习 > JS >>

怎么判断浏览器类型

本文章介绍一下关于js 判断浏览器类型一款简单实例函数,可以方便简单的获取用户浏览器的相关信息与类型。

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.zhutiai.com/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>怎么判断浏览器类型</title>
<script language="网页特效">
function $nav()
{
 if(window.navigator.useragent.indexof("msie")>=1) return 'ie';
 else if(window.navigator.useragent.indexof("firefox")>=1) return 'ff';
 else return "ot";
}
alert($nav());

//如何要获取浏览器其它信息

alert(window.navigator.useragent);

</script>
</head>

<body>
</body>
</html>

补充:网页制作,js教程 
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,