识别是否ie浏览器

function IEVersion()
{
var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera; //判断是否IE浏览器
var isEdge = userAgent.indexOf("Windows NT 6.1; Trident/7.0;") > -1 && !isIE; //判断是否IE的Edge浏览器
if(isIE)
{
return true;
}
else if(isEdge)
{
return true;
}
return false;
}

posted on 2017-08-25 17:47  追_风  阅读(227)  评论(0编辑  收藏  举报

导航