现在的位置: 首页 > 综合 > 正文

js 判断该浏览器是否为w3c标准,既非IE浏览器

2018年05月14日 ⁄ 综合 ⁄ 共 618字 ⁄ 字号 评论关闭
   //判断该浏览器是否为w3c标准,既非IE浏览器
  if(window.navigator.userAgent.indexOf("Firefox") >= 1){
	  //获取事件
	  
  }else if(window.navigator.userAgent.indexOf("MSIE") >= 1){
	   //ie浏览器
  	  var version=window.navigator.userAgent;
        //<!--IE7-->
              if(navigator.appVersion.match(/7./i)=='7.'){
                    $("tile").append("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE7\" />");   
              }
         //<!--IE8-->
              if(navigator.appVersion.match(/8./i)=='8.'){
                   $("tile").append("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE8\" />");
                   alert("ie8");
              }
		      if(navigator.appVersion.match(/9./i)=='9.'){
                   $("tile").append("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE9\" />");
                   alert("ie9");
              }
	}

抱歉!评论已关闭.