4

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?

Robert Munteanu
  • 67,031
  • 36
  • 206
  • 278

4 Answers4

2

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

http://code.google.com/p/google-web-toolkit-doc-1-5/wiki/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.

Eliran Malka
  • 15,821
  • 6
  • 77
  • 100
DLH
  • 2,771
  • 3
  • 23
  • 30
1

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
  • 6,455
  • 4
  • 33
  • 42
  • 1
    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 Jun 07 '09 at 22:49
  • 1
    fine their official list here: http://code.google.com/webtoolkit/doc/latest/FAQ_GettingStarted.html#What_browsers_does_GWT_support? – Jeffrey Blattman Jun 13 '11 at 20:49
0

I realise this is an old question, but I had the same problem, and wanted to share a new solution for it.

Today with GWT2.7 "obsolete" browsers try to download undefined.cache.js. This obviously fails and the client is stuck forever.

You could patch GWT itself setting fallback compile steps, but the easy solution is to simply provide a (manually crafted) undefined.cache.js and place it where the other generated files are.

Inside you put this one line:

xxxxxxx.onScriptDownloaded(alert('This browser is not supported anymore.\nPlease upgrade to a more recent browser.'));

where xxxxxxx is your module basename (from xxxxxxxx.gwt.xml).

geert3
  • 7,086
  • 1
  • 33
  • 49
0

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.