Korbs revised this gist 9 months ago. Go to revision
1 file changed, 9 insertions
ie-detection.js(file created)
| @@ -0,0 +1,9 @@ | |||
| 1 | + | function GetIEVersion() { | |
| 2 | + | var sAgent = window.navigator.userAgent; | |
| 3 | + | var Idx = sAgent.indexOf("MSIE"); | |
| 4 | + | if (Idx > 0) | |
| 5 | + | return parseInt(sAgent.substring(Idx+ 5, sAgent.indexOf(".", Idx))); | |
| 6 | + | else if (!!navigator.userAgent.match(/Trident\/7\./)) | |
| 7 | + | return 11; else return 0; | |
| 8 | + | } | |
| 9 | + | if (GetIEVersion() > 0) {document.write("This is IE " + GetIEVersion());document.write('<div id="out"><p>You are using an unsupported browser.</p><p style="font-size: 14px;">Try a different web browser:</p><ui><li><a href="https://www.microsoft.com/en-us/edge?r=1">Microsoft Edge</a></li><li><a href="https://www.google.com/chrome/">Google Chrome</a></li><li><a href="https://www.mozilla.org/en-US/firefox/new/">Firefox</a></li><li><a href="https://opera.com/">Opera</a></li></ui><p>You are using Internet Explorer ' + GetIEVersion() +'</p></div> <style>a {color: white;} li {font-size: 14px;} div#out {position: fixed;z-index: 999;background: black;color: white;border: none;top: 0px;left: 0px;width: 100%;height: 100%;padding: 30px;}</style>')} else {} | |
Newer
Older