Skip to content
Advertisement

Internet Explorer 11 detection

I know IE 11 has different user agent string than all other IE

JavaScript

I have tried to detect IE 11 with answer specified for this question’

Jquery fail to detect IE 11

Thats !!navigator.userAgent.match(/Trident/7./)

But I am getting error Object not found and needs to be re-evaluated.

Then I openede developer console in IE11 and tried to access some predefined javascript objects, I am still getting same error.

I have tried

navigator.userAgent

window.navigator

console.log('test');

Anyone have any idea about it ?

Advertisement

Answer

Edit 18 Nov 2016

This code also work (for those who prefer another solution , without using ActiveX)

JavaScript

Original Answer

In order to check Ie11 , you can use this : ( tested)

(or run this)

!(window.ActiveXObject) && "ActiveXObject" in window

I have all VMS of IE :

enter image description here

enter image description here

enter image description here

enter image description here

Notice : this wont work for IE11 :

as you can see here , it returns true :

enter image description here

So what can we do :

Apparently , they added the machine bit space :

ie11 :

JavaScript

ie12 :

JavaScript

so we can do:

JavaScript

this will return true only for ie11.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement