`

浏览器判断

 
阅读更多
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!!游览器不安全,请选择较高版本游览器!");
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics