Home >Web Front-end >JS Tutorial >An example of judging IE8 and below versions

An example of judging IE8 and below versions

零下一度
零下一度Original
2017-06-24 14:17:291744browse

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 = &#39;IEBrowser.html&#39;;
}

})();
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 &#39;微软雅黑&#39;;">浏览器下载</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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn