var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串 var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器 var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1; var browser = { versions: function () { var u = navigator.userAgent; return { trident: u.indexOf('Trident') > -1, //IE内核 }; }() } if (browser.versions.trident || isIE11) { window.location.href = "https://support.dmeng.net/upgrade-your-browser.html" rel="nofollow" }