Last active
July 20, 2020 09:15
-
-
Save lihe6666/5b157520d3a1c6a8aafb51a8ea5828fd to your computer and use it in GitHub Desktop.
[checkIEVersion] Check is ie browser version. #check #javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function() { | |
| setTimeout(function() { | |
| var div = document.createElement('div'); | |
| div.id = 'js_ie_notsupport'; | |
| div.innerHTML='<div class="ie-not-support">将浏览器更新为Firefox浏览器或Chrome浏览器,以获得更好的体验</div>' | |
| if (window.attachEvent) { | |
| window.attachEvent('onload', checkIEVersion); | |
| } else if (window.addEventListener) { | |
| window.addEventListener('load', checkIEVersion, false); | |
| } | |
| function checkIEVersion() { | |
| var ua = navigator.userAgent; | |
| if ((ua.indexOf('compatible') !== -1) && (ua.indexOf('MSIE') !== -1)) { | |
| if (ua.indexOf('rv') === -1) { | |
| document.body.appendChild(div); | |
| } | |
| } | |
| } | |
| }, 0) | |
| })() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment