Checking for Internet Explorer 10/11 and Edge with JavaScript

In my experience, Internet Explorer has some quirks and nuances that can make working in JavaScript challenging. Often things have to be done differently when dealing with one (or all) of Microsoft’s browsers.

The following snippet is a really simple method of browser sniffing by user-agent, detecting IE 10, 11 or Edge.

function isIE(userAgent) {
userAgent = userAgent || navigator.userAgent;
return userAgent.indexOf("MSIE ") > -1 || userAgent.indexOf("Trident/") > -1 || userAgent.indexOf("Edge/") > -1;
view raw global.js hosted with ❤ by GitHub

Reader Interactions

Leave a Reply

Your email address will not be published.