您的位置:首页 > Web前端 > JavaScript

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

2014-07-18 14:20 309 查看
//判断该浏览器是否为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");
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: