日期:2014-05-16  浏览次数:20378 次

js判断浏览器类型
var request = false;
var btype=getInternet();?
function getInternet()???
{???
if(navigator.userAgent.indexOf("MSIE")>0) {???
????????????? return "MSIE";?????? //IE浏览器?
}?
if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){???
????????????? return "Firefox";???? //Firefox浏览器?
}?
if(isSafari=navigator.userAgent.indexOf("Safari")>0) {???
????????????? return "Safari";????? //Safan浏览器?
}?
if(isCamino=navigator.userAgent.indexOf("Camino")>0){???
????????????? return "Camino";?? //Camino浏览器?
}?
if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){???
????????????? return "Gecko";??? //Gecko浏览器?
}???
}??
try {
? request = new XMLHttpRequest();
} catch (trymicrosoft) {
? try {
??? request = new ActiveXObject("Msxml2.XMLHTTP");//支持microsoft
? } catch (othermicrosoft) {
??? try {
????? request = new ActiveXObject("Microsoft.XMLHTTP");//支持非microsoft
??? } catch (failed) {
????? request = false;?
??? }?
}
}

if(!request)
? alert("Error!!游览器不安全,请选择较高版本游览器!");