GWT and browser selection

Tue, 23/09/2008 - 20:27

I've just been propelled across the project barrier and into our GWT project. A project which took over 10m to compile ... and so I spent yesterday updating our Maven scripts to use the latest version of the plugin, and investigating speeding it up.

GWT generatates output based on (browsers supported) * (locales supported). Even with a single locale you're still generating HTML/JS for 6 browsers. Great for production, rubbish for development. And so, you can restrict them.

Modify your module gwt.xml to set the user.agent property. Your valid options are ie6, gecko, gecko1_8, safari and opera. You use set-property to set the first and extend-property to set extra agents, if required.

	<set-property name=“user.agent” value=“gecko1_8” />
	<extend-property name=“user.agent” values=“safari” />

And watch the build time drop! Be aware, however, that using the application in an unsupported browser will lead to some very odd errors.

Should you be using internationalisation you can also limit the supported locales in a similar manner. Just watch you don't ship the modified module!