Skip to content

Instantly share code, notes, and snippets.

@pbakondy
Created August 18, 2014 11:39
Show Gist options
  • Save pbakondy/cf4c8f79a2cd3e6ce390 to your computer and use it in GitHub Desktop.
Save pbakondy/cf4c8f79a2cd3e6ce390 to your computer and use it in GitHub Desktop.
Get IE version
// determine Internet Explorer version
// add class 'ieX' to html
window.ieVersion = (function() {
var ddm = document.documentMode;
var html = document.documentElement;
if (Math.round(ddm) === ddm){
if (html.classList) {
html.classList.add('ie' + ddm);
} else {
html.className += ' ie' + ddm;
}
return ddm;
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment