tags:

views:

4902

answers:

4

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

In the article I learned I can speed up the compiler but specifying the target user agent. The problem how can I specify more than one user agent? Suppose my application supports ie6 and FF3

<set-property name="user.agent" value="ie6,geck1_8" />

doesn't work - I got XML parsing error:

[ERROR] Invalid property value 'ie6,gecko1_8'

I'm wondering if there's a way to specify more than one specific user agent in the module XML file?

+1  A: 

Not yet. The idea is that you develop rapidly to one browser and then compile once to deploy (i.e., do final testing) for all browsers, with GWT handling the browser differences. Don't forget that at deploy time GWT will optimize the downloads per browser so that in the end it doesn't matter how many user agents you chose.

Glenn
+2  A: 

Works in GWT 1.6, your *.gwt.xml file :

<module rename-to="moduleName">
      <!-- blah blah -->
      <set-property name="user.agent" value="ie6,gecko,gecko1_8" />
      <!-- generate perms for IE and firefox only -->
</module>
ShashiKant
+1  A: 

In order to rapidly deploy any application, you'll need two targets; once for the engine your hosted mode deploys on {Firefox / Linux, Safari / Mac, IE6 / Win}, and one for your agile browser that lets you build css in real-time {Firefox + Firebug}.

Linux: <set-property name="user.agent" value="gecko1_8,gecko"/>
Mac: <set-property name="user.agent" value="gecko1_8,safari"/>
...etc...

This is GWT >= 1.6 ONLY!

For older gwt projects, you must super-source the com/google/gwt/user/UserAgent.gwt.xml file... Put it in a source location that is included BEFORE your gwt-*.jar on the classpath. Basically, you can copy that file into a new one in the same package as the original, and edit the CDATA javascript block that returns the actual user.agent value. Play with this all you like, but don't go getting too crazy with their user.agent property, as it WILL be changing for ie8 in a future build.

To target ie browsers, make up your own ie.version property, and tweak a copy of the property-provider in UserAgent.gwt.xml to target different versions of ie. Just make sure that when you use the custom property for deferred binding you do:

<all>
  <when-property-is name="user.agent" value="ie6"/>
  <any>
    <when-property-is name="ie.version" value="ie7"/>
    <when-property-is name="ie.version" value="ie8"/>
  </any>
</all>

Or you'll get ie7 + gecko/safari builds and other silly junk that will never be used.

Note: Any code in a property-provider is loaded in the .nocache.js, and can be useful to preload images / css whilst the .cache.js payload is being downloaded.
Just add var __cached = new Image('Url To Compiled Image / Whatever you want to load');

A: 

whats the option for chrome? and why isnt there a list of browsers vs user.agent options? Ive heard that chrome is "webkit", is there an option for webkit?

John