Skip to content

Instantly share code, notes, and snippets.

@rkotze
Created February 20, 2019 10:55
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 rkotze/5df52aa568aa696962e9927a0c92041b to your computer and use it in GitHub Desktop.
Save rkotze/5df52aa568aa696962e9927a0c92041b to your computer and use it in GitHub Desktop.
Detect if Internet Explorer and return the version
function detectIE(){
var IE = navigator.userAgent.match(/MSIE\s([0-9]+)\./);
if(IE) return parseInt(IE[1], 10);
var IE11 = navigator.userAgent.match(/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/);
if(IE11) return parseInt(IE11[1], 10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment