Internet Explorer 11 detection
Edit 18 Nov 2016
This code also work (for those who prefer another solution , without using ActiveX)
var isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
// true on IE11
// false on Edge and other IEs/browsers.
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 :
Notice : this wont work for IE11 :
as you can see here , it returns true :
So what can we do :
Apparently , they added the machine bit space :
ie11 :
"Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; rv:11.0) like Gecko"
ie12 :
"Mozilla/5.0 (Windows NT 6.3; Win64; x64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; rv:11.0) like Gecko"
so we can do:
/x64|x32/ig.test(window.navigator.userAgent)
this will return true only for ie11.
To detect MSIE (from version 6 to 11) quickly:
if(navigator.userAgent.indexOf('MSIE')!==-1
|| navigator.appVersion.indexOf('Trident/') > -1){
/* Microsoft Internet Explorer detected in. */
}
I use the following function to detect version 9, 10 and 11 of IE:
function ieVersion() {
var ua = window.navigator.userAgent;
if (ua.indexOf("Trident/7.0") > -1)
return 11;
else if (ua.indexOf("Trident/6.0") > -1)
return 10;
else if (ua.indexOf("Trident/5.0") > -1)
return 9;
else
return 0; // not IE9, 10 or 11
}
All of the above answers ignore the fact that you mention you have no window or navigator :-)
Then I openede developer console in IE11
and thats where it says
Object not found and needs to be re-evaluated.
and navigator, window, console, none of them exist and need to be re-evaluated. I've had that in emulation. just close and open the console a few times.