// ie兼容提示
window.onload = function () {
var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
if (isIE) {
alert('IE浏览器')
} else if (isEdge) {
alert('Edge浏览器')
} else if (isIE11) {
alert('isIE11')
}
elss{
alert('其他浏览器')
}
}
js判断当前是否为ie浏览器的方法
最新推荐文章于 2024-04-26 09:24:31 发布