Reputation: 12207
As far as I know the "user.agent" property in the Google Web Toolkit .gwt.xml file specifies the targets for the Java to Java Script translation. Because the hosted mode still runs Java and not Javascript I don't understand why google chrome complains that the "user.agent" value is not set correctly. Even more strange, it keeps complaining even if I add "safari" to it with <set-property name="user.agent" value="gecko1_8,safari" />
.
What can I do here?
I use GWT version 2.3.0 and GXT version 2.2.5.
Upvotes: 1
Views: 1490
Reputation: 64561
DevMode does not compile to JavaScript but still has to honor deferred binding rules, and many of them are based on the user.agent
property, so it must be correctly set.
The user.agent
property value is determined by some script snippet generated in the so-called selection script (the *.nocache.js
file), and the content of this script can depend on the set-property
s you have in your GWT module(s).
For instance, if you compile a GWT module with <set-property name="user.agent" value="gecko1_8" />
, the user.agent
property will be hard-coded to the gecko1_8
value in the *.nocache.js
.
If you later run DevMode, unless it thinks it has to overwrite the existing *.nocache.js
, it'll use it; so running the app using Chrome when the *.nocache.js
was generated for gecko1_8
only will cause an error similar to:
com.google.gwt.core.client.JavaScriptException: (TypeError): Property 'user.agent' of object is not a function
In case you compiled for several browsers, but then run DevMode with a module only for gecko1_8
, then the DevMode will use the property provider found in the *.nocache.js
to determine the actual user agent being used (woul dbe safari
for Chrome), and will compare it with the one determined from the module (hard-coded here to gecko1_8
), and will then warn you that they don't match (and as such that you app might dysfunction: the code will use DOMImplMozilla
for instance, whereas DOMImplSafari
should have been used in Chrome).
So, to fix this, either delete the *.nocache.js
file so DevMode will have to generate a new one, or recompile your app with a module whose user.agent
values match the browser you'll use in DevMode.
Upvotes: 3