Supporting deprecated/unknown browsers

255 views
Skip to first unread message

Honza Rames

unread,
Jun 13, 2014, 2:43:00 AM6/13/14
to google-we...@googlegroups.com
Hi everyone,
recently I was asked to support older browsers (namely Opera 12.17). Opera permutations have been disabled for quite some time (I'm using trunk build of GWT) and for unknown browsers the user.agent selection script just returns "unknown" which makes the module fail to load. Since we're talking Opera here I thought "Hey! It should mostly work with safari or gecko permutations right?". I dug a little deeper in how the selection works and ended up modifying UserAgentPropertyGenerator. But modifying stock GWT one (I just placed my new implementation in my project's class path, you don't need to recompile GWT to make it work) has a downside since the UserAgentAsserter stops working and I wanted to use it to show some message to the user about unsupported browser. This is because UserAgent class that is responsible for the values being compared is generated by the very same UserAgentPropertyGenerator. After a while I figured I could replace the generator only for the selection script by modifying my gwt.xml file. So I ended up with something like this:

<!-- Returns 'safari' instead of 'unknown' -->
<property-provider name="user.agent" generator="my.own.UserAgentPropertyGenerator"/>
<!-- Since plain AssertionError isn't good enough for me I use my own asserter as well -->
<set-configuration-property name="user.agent.runtimeWarning" value="false"/>
<!-- My own asserter that throws more specific exception -->
<entry-point class="my.own.UserAgentAsserter" />
With this approach you don't need to copy any GWT internals (which I think is way better).

My questions are, did someone tried to use something similar? What approach did you take? Are there some problems with this one?

GWT provides property error function callback, it would be great if this function could be used to return a fallback value. Are these callback something that is likely to change or is it something that can be used in production? The documentation on this is pretty bad though :-(.

Honza

Jens

unread,
Jun 13, 2014, 5:14:10 AM6/13/14
to google-we...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages