根据 appName 及 appVersion 判断IE版本
window.navigator.appName == “Microsoft Internet Explorer”
window.navigator.appVersion.split( “;” )[1].replace(/[ ]/g, “” ).replace( “MSIE” , “” )
IE9及以下版本显示引导页,封装插件源码
/**
* window.navigator.appName
* IE9及以下版本 显示引导页面
* author jzt 2022-08-29
*/
;(function() {
window.IEVersion = window.navigator.appName == "Microsoft Internet Explorer" && parseInt(window.navigator.appVersion.split( ";" )[1].replace(/[ ]/g, "" ).replace( "MSIE" , "" )) < 10;
var ieHtml = '<div class="IEVersion" id="IEVersion">\
<div class="shadow"></div><div class="msg"><p class="t1">悲催,无法支持当前浏览器访问</p><p class="t2">建议更换成以下浏览器后重新访问</p><div class="zl clear"><div class="item"><a class="text"href="https://browser.qq.com/"target="_blank"><img class="icont"src="//cdn.51img3.com/game/2022/202203/20220318/ed02390ac08779d1896e3aae6da3dd92.png"alt="QQ浏览器"><p>QQ浏览器</p></a></div><div class="item"><a class="text"href="https://www.microsoft.com/zh-cn/edge/"target="_blank"><img class="icont"src="//cdn.51img3.com/game/2022/202203/20220318/4425a2b6788312fd2276d6252bd78f54.png"alt="Edge"><p>Edge</p></a></div><div class="item"><a class="text"href="https://www.google.cn/intl/zh-CN/chrome/"target="_blank"><img class="icont"src="//cdn.51img3.com/game/2022/202203/20220318/95bad6c149dc3125abb5e1a75a81df04.png"alt="Chrome"><p>Chrome</p></a></div></div></div>\
<style>#IEVersion{width:100%;height:100%;left:0;top:0;position:fixed;z-index:99}#IEVersion .shadow{width:100%;height:100%;position:fixed;top:0;left:0;z-index:20;background:#f3f0f7}#IEVersion .msg{width:500px;position:absolute;top:50%;left:50%;margin-top:-175px;margin-left:-250px;z-index:25;background:transparent;text-align:center;font-style:18px}#IEVersion .msg .t1{font-size:18px;color:#3c3c3c;font-weight:400}#IEVersion .msg .t2{color:#757575;margin-top:5px;font-size:14px}#IEVersion .msg .zl{width:300px;margin:0 auto;margin-top:30px}#IEVersion .msg .zl .item{margin:0 10px;float:left;width:80px;text-align:center}#IEVersion .msg .zl .item .icont{width:48px;height:48px;display:block;margin:0 auto 10px}#IEVersion .msg .zl .item .text{font-size:12px;color:#4cbeff}</style></div>';
if(IEVersion) { $("body").append(ieHtml); }
})();