Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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