tags:

views:

1082

answers:

3

I want to display a message to users with unsupported browsers, as opposed to having the site fail in an ugly manner.

What's the best way to do that?

+1  A: 

The GWT team does not provide a list of unsupported browsers, only supported browsers, and it's a vague list at that "most recent versions of Internet Explorer, Firefox, and Safari. (Opera, too, most of the time.)".

If you have a good idea yourself of what browser/version won't work you can use this code:

  public static native String getUserAgent() /*-{
     return navigator.userAgent.toLowerCase();
  }-*/

to learn what browser is being used and perhaps cook up a work-around.

On the other hand, browser rendering of web pages can fail in many subtle ways ranging from mildly annoying to catastrophic, and there is often no way to know where your page falls on that scale. One of the major reasons for GWT is that you can stop worrying about this sort of thing. At least until it happens.

Glenn
I think cooking up a workaround would be pretty challenging for GWT, considering that the JavaScript it serves is based on the browser it thinks it's serving to. If it helps, here's ppk's latest browser detect, which is new enough to identify Chrome and iPhone: http://www.quirksmode.org/js/detect.html
Nosredna
+2  A: 

GWT also provides browser detection using the .gwt.xml file. Have a look at this:

http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=DevGuideDeferredBindingReplacement

It's an interesting solution, but I'm not sure if it's the best solution in your case. It could be very useful for creating a simplified version of your application which would automatically be loaded in unsupported browsers.

DLH
A: 

If you want to make it simple and stupid, check with some javascript code in your main html file, before GWT is loaded. Novertheless, I would rather trust GWT to handle things more or less quirky. You could also just recommend chrome or firefox.