Home >Web Front-end >JS Tutorial >An example of judging IE8 and below versions
Determine IE8 and below versions:
(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>
It is said that learning front-end is not easy, and IE is also a big trouble. Everyone should reject IE together. hehe.
The above is the detailed content of An example of judging IE8 and below versions. For more information, please follow other related articles on the PHP Chinese website!