标签:浏览器 判断浏览器类型 navigator.useragent.indexof
navigator.userAgent.indexOf来判断浏览器类型
<script language="JavaScript">
<!--
function getOs()
{
var OsObject
= "";
if(navigator.userAgent.indexOf("MSIE")>0) {
return "MSIE";
}
if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){
return "Firefox";
}
if(isSafari=navigator.userAgent.indexOf("Safari")>0)
{
return "Safari";
}
if(isCamino=navigator.userAgent.indexOf("Camino")>0){
return "Camino";
}
if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){
return "Gecko";
}
}
alert("您的浏览器类型为:"+getOs());
-->
</script>
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
http_request
= new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
http_request
= new ActiveXObject("Microsoft.XMLHTTP");
}
标签:浏览器 判断浏览器类型 navigator.useragent.indexof
原文地址:http://haihuiwei.blog.51cto.com/4789207/1670472