Skip to content

Instantly share code, notes, and snippets.

@marxo
Created December 7, 2017 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marxo/4cdebe9f4b4757075b5ee02586510045 to your computer and use it in GitHub Desktop.
Save marxo/4cdebe9f4b4757075b5ee02586510045 to your computer and use it in GitHub Desktop.
ie11
// Detect IE and append class to <html> element
var UA = navigator.userAgent;
var html = document.documentElement;
if (UA.indexOf("IEMobile") === -1) {
if ((UA.indexOf("rv:11.") !== -1) && (!html.classList.contains('ie11')) && window.navigator.msPointerEnabled) {
html.classList.add("ie11");
} else if ((UA.indexOf("MSIE 10.") !== -1) && (!html.classList.contains('ie10')) && window.navigator.msPointerEnabled) {
html.classList.add("ie10");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment