我正在使用GWT 2.4(我无法将我的版本升级到2.5) 我遇到了以下问题:当我使用Chrome,Firefox或Internet Explorer 9 10时,我的系统运行良好;通过使用Internet Explorer 8,我的系统完全不起作用;它向用户显示一个空白页面,我收到以下javascript错误:
Dettagli errore pagina Web
Agente utente:Mozilla / 4.0(兼容; MSIE 8.0; Windows NT 5.1; Trident / 4.0) 时间戳:星期四,2013年9月5日10:56:58 UTC
Messaggio:Argomento无效。 Linea:28410 Carattere:54 Codice:0 URI:http://app.it:8080/myApp/F662F41B287D1686DCB056062754DFEB.cache.html
我正在网上搜索,我找到了这个链接:https://code.google.com/p/google-web-toolkit/issues/detail?id=6665 在这个GWT问题中,解释了GWT 2.4在IE8和chromeframe方面存在一些问题;我做了他们的建议;事实上,我所做的是:
PropertyProviderGenerator
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.linker.ConfigurationProperty;
import com.google.gwt.core.ext.linker.PropertyProviderGenerator;
import java.util.Arrays;
import java.util.List;
import java.util.SortedSet;
public class CustomUserAgentPropertyGenerator implements PropertyProviderGenerator {
private static final List<String> VALID_VALUES = Arrays.asList(new String[]{"ie6", "ie8", "gecko1_8", "safari", "opera", "ie9"});
private static UserAgentPropertyGeneratorPredicate[] predicates =
new UserAgentPropertyGeneratorPredicate[] {
// opera
new UserAgentPropertyGeneratorPredicate("opera")
.getPredicateBlock()
.println("return (ua.indexOf('opera') != -1);")
.returns("'opera'"),
// webkit family (chrome, safari and chromeframe).
new UserAgentPropertyGeneratorPredicate("safari")
.getPredicateBlock()
.println("return (ua.indexOf('webkit') != -1);")
.returns("'safari'"),
// IE9
new UserAgentPropertyGeneratorPredicate("ie9")
.getPredicateBlock()
.println("return (ua.indexOf('msie') != -1 && ($doc.documentMode >= 9));")
.returns("'ie9'"),
// IE8
new UserAgentPropertyGeneratorPredicate("ie8")
.getPredicateBlock()
.println("return (ua.indexOf('msie') != -1 && ($doc.documentMode >= 8));")
.returns("'ie8'"),
// IE6
new UserAgentPropertyGeneratorPredicate("ie6")
.getPredicateBlock()
.println("var result = /msie ([0-9]+)\\.([0-9]+)/.exec(ua);")
.println("if (result && result.length == 3)")
.indent()
.println("return (makeVersion(result) >= 6000);")
.outdent()
.returns("'ie6'"),
// gecko family
new UserAgentPropertyGeneratorPredicate("gecko1_8")
.getPredicateBlock()
.println("return (ua.indexOf('gecko') != -1);")
.returns("'gecko1_8'"),
};
static void writeUserAgentPropertyJavaScript(SourceWriter body, SortedSet<String> possibleValues) {
// write preamble
body.println("var ua = navigator.userAgent.toLowerCase();");
body.println("var makeVersion = function(result) {");
body.indent();
body.println("return (parseInt(result[1]) * 1000) + parseInt(result[2]);");
body.outdent();
body.println("};");
// write only selected user agents
for (int i = 0; i < predicates.length; i++) {
if (possibleValues.contains(predicates[i].getUserAgent())) {
body.println("if ((function() { ");
body.indent();
body.print(predicates[i].toString());
body.outdent();
body.println("})()) return " + predicates[i].getReturnValue() + ";");
}
}
// default return
body.println("return 'unknown';");
}
public String generate(TreeLogger logger, SortedSet<String> possibleValues, String fallback, SortedSet<ConfigurationProperty> configProperties) {
for (String value : possibleValues) {
if (!VALID_VALUES.contains(value)) {
logger.log(TreeLogger.WARN, "Unrecognized "
+ UserAgentGenerator.PROPERTY_USER_AGENT + " property value '"
+ value + "', possibly due to UserAgent.gwt.xml and "
+ UserAgentPropertyGenerator.class.getName()
+ " being out of sync." + " Use <set-configuration-property name=\""
+ UserAgentGenerator.PROPERTY_USER_AGENT_RUNTIME_WARNING
+ "\" value=\"false\"/> to suppress this warning message.");
}
}
assert predicates.length == VALID_VALUES.size();
StringSourceWriter body = new StringSourceWriter();
body.println("{");
body.indent();
writeUserAgentPropertyJavaScript(body, possibleValues);
body.outdent();
body.println("}");
return body.toString();
}
}
MySystem.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='mysystem'>
<!-- some inherits -->
<property-provider name="user.agent" generator="com.google.gwt.user.rebind.mysystemUserAgentPropertyGenerator"/>
<inherits name="com.google.gwt.user.UserAgent"/>
<set-configuration-property name="user.agent.runtimeWarning" value="false"/>
<!-- the rest of the file -->
<extend-property name="locale" values="en, it" />
</module>
可悲的是,通过这种方式,我没有解决问题 任何人都可以向我建议任何其他尝试吗?
谢谢
安吉洛
答案 0 :(得分:2)
加载GWT模块的方式,稍后定义的任何内容覆盖先前定义的内容,并且<inherits>
被处理,好像继承的模块已就地包含在内。
因此,您应该在<property-provider>
行后移动<inherits name="com.google.gwt.user.UserAgent"/>
行。
答案 1 :(得分:0)
您是否尝试清除浏览器和IDE中的所有缓存?在intellij我经常不得不停止intellij想法,清除cache / gwt dieclipse并再次启动intellij以摆脱这种虚假问题。与eclipse相同。