Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ext.isIE return false in IE 11

Tags:

extjs

extjs4.2

When I try to use Ext.isIE in IE11 i get false the returning value. And then during the debug my code I see that I get the following error: JavaScript Error - Msg:Invalid argument., my extjs's version is: 4,2

like image 588
Vahe Akhsakhalyan Avatar asked Feb 19 '14 13:02

Vahe Akhsakhalyan


3 Answers

IE 11 is not officially supported prior to ExtJS 4.2.2 (see property isIE11). Microsoft removed the MSIE part from IE11's user agent (refer here), which is the reason why it does not work with ExtJS 4.2.1 and below.

From the source code, for ExtJS 4.2.1:

isIE = !isOpera && check(/msie/),
isIE7 = isIE && ((check(/msie 7/) && docMode != 8 && docMode != 9 && docMode != 10) || docMode == 7),
isIE8 = isIE && ((check(/msie 8/) && docMode != 7 && docMode != 9 && docMode != 10) || docMode == 8),
isIE9 = isIE && ((check(/msie 9/) && docMode != 7 && docMode != 8 && docMode != 10) || docMode == 9),
isIE10 = isIE && ((check(/msie 10/) && docMode != 7 && docMode != 8 && docMode != 9) || docMode == 10),
isIE6 = isIE && check(/msie 6/),

and for ExtJS 4.2.2:

isIE = !isOpera && (check(/msie/) || check(/trident/)),
isIE7 = isIE && ((check(/msie 7/) && docMode != 8 && docMode != 9 && docMode != 10) || docMode == 7),
isIE8 = isIE && ((check(/msie 8/) && docMode != 7 && docMode != 9 && docMode != 10) || docMode == 8),
isIE9 = isIE && ((check(/msie 9/) && docMode != 7 && docMode != 8 && docMode != 10) || docMode == 9),
isIE10 = isIE && ((check(/msie 10/) && docMode != 7 && docMode != 8 && docMode != 9) || docMode == 10),
isIE11 = isIE && ((check(/trident\/7\.0/) && docMode != 7 && docMode != 8 && docMode != 9 && docMode != 10) || docMode == 11),
isIE6 = isIE && check(/msie 6/),
like image 168
matt Avatar answered Nov 15 '22 02:11

matt


It's very simple:

navigator.userAgent.toLowerCase().lastIndexOf('rv:11') > -1

will return true if it's a IE11 browser.

like image 45
Nandeesh Avatar answered Nov 15 '22 02:11

Nandeesh


This works for me:

var isIE11 = window.location.hash = !!window.MSInputMethodContext;

like image 1
ssamuel68 Avatar answered Nov 15 '22 04:11

ssamuel68