if(u_agent.indexOf("Firefox")>0)这样是否可以
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>navigator</title>
<script type="text/javascript">
function validB(){
var u_agent = navigator.userAgent ;
var B_name="不是想用的主流浏览器!";
if(u_agent.indexOf("Firefox")>0){
B_name="Firefox";
}else if(u_agent.indexOf("Chrome")>0){
B_name="Chrome";
}else if(u_agent.indexOf("MSIE")>0&&u_agent.indexOf("Trident")>0){
B_name="IE(8-10)";
}
document.write("浏览器:"+B_name+"<br>");
document.write("u_agent:"+u_agent+"<br>");
}
</script>
</head>
<body>
<form>
<input type="button" onClick=validB() value="查看浏览器" >
</form>
</body>
</html>