Skip to content

Instantly share code, notes, and snippets.

@kaspar-allenbach
Created January 30, 2019 12:44
Show Gist options
  • Save kaspar-allenbach/95091836b29d16ae01fda9861d713e47 to your computer and use it in GitHub Desktop.
Save kaspar-allenbach/95091836b29d16ae01fda9861d713e47 to your computer and use it in GitHub Desktop.
IE 11 detection + add warning div to body
//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