Created
January 30, 2019 12:44
-
-
Save kaspar-allenbach/95091836b29d16ae01fda9861d713e47 to your computer and use it in GitHub Desktop.
IE 11 detection + add warning div to body
This file contains 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
//check for ie methods | |
var isIE11 = !!window.MSInputMethodContext && !!document.documentMode; | |
//start if ie | |
if (isIE11 == true) { | |
//add tags to body to write scoped css | |
document.body.className += " " + "internetExplorer ie11" | |
//add div element to warn users that they are using an outdated browser | |
window.document.body.insertAdjacentHTML( 'afterbegin', '<div class="oldIE">You are using an outdated Browser…</div>' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment