0

I want to let the user know if the browser they are using is IE and if so, pop a warning message.

Currently I have the following right before the div IDs are loaded.

if(SC.isIE())
{
   SC.warn("You are using IE, please switch")
}

but this does not seem to work when I test it with the latest IE. Is there another way to do this (using jQuery), a better way in SmartGWT? or I am putting the isIE() at the wrong place. My first choice is doing this using smartGWT.

PhoonOne
  • 2,678
  • 12
  • 48
  • 76

1 Answers1

1

Alternatively try with plain GWT by detecting Window.Navigator.getUserAgent()

Sample code:

public static boolean isIEBrowser() {
    return (Window.Navigator.getUserAgent().toUpperCase().indexOf("MSIE") !=-1);
}

Note: Please have a look at User-agent string changes for Internet Explorer 11

Please read How to detect IE11?


IE11 on Windows 8 User agent string

Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko 

IE10 on Windows 8 User agent string:

Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)
Community
  • 1
  • 1
Braj
  • 46,415
  • 5
  • 60
  • 76
  • Unless IE11, in which case test for trident too IIRC. – Colin Alworth May 20 '14 at 22:06
  • @ColinAlworth Thanks a lot I have edited it in my post. – Braj May 20 '14 at 22:15
  • @Braj so how do I detect 11 using gwt? the link you posted seems to be javascript code only – PhoonOne May 21 '14 at 12:40
  • You can check `Trident/7.0; rv:11.0` for IE11 in java code itself after getting useragent string using `Window.Navigator.getUserAgent()` or get the idea from the JavaScript and use that logic in Java code – Braj May 21 '14 at 12:47