当前位置:Gxlcms > JavaScript > 判断IE8及以下版本的一个实例

判断IE8及以下版本的一个实例

时间:2021-07-01 10:21:17 帮助过:5人阅读

判断IE8及以下版本:

(function(){var isIE = function () {var U = navigator.userAgent,
IsIE = U.indexOf('MSIE') > -1,
a = IsIE ? /\d+/.exec(U.split(';')[1]) : 'no ie';return a <= 8;
}();if(isIE){
window.location.href = 'IEBrowser.html';
}

})();
IEBrowser.html
    <div style="border:5px red solid; margin: 10% auto; text-align: center; color: red;"><img style="margin: 20px 0"; src="img/IE.png"><h1 style="line-height: 50px">珍爱生命,远离IE!</h1><h1 style="line-height: 40px">本站不支持IE8及其以下所有版本的IE浏览器浏览! 请摒弃老旧的IE使用高级浏览器访问本站!</h1><a href="https://www.baidu.com/s?wd=浏览器&rsv_spt=1&rsv_iqid=0xed4aa79300016c40&issp=1&f=8&rsv_bp=0&rsv_idx=2&ie=utf-8&rqlang=&tn=maxthon2&ch=2&rsv_enter=1&inputT=507" target="_blank" style="font: 30px/60px '微软雅黑';">浏览器下载</a></div>

都说学前端不易,IE这根搅屎棍也是个大麻烦,大家都应该一起拒绝IE。呵呵。

以上就是判断IE8及以下版本的一个实例的详细内容,更多请关注Gxl网其它相关文章!

人气教程排行