GWT 历史 JavaScript 在 Internet Explorer 中无法运行
我无法让 Google Web Toolkit 的 History 类在 Internet Explorer 中工作,即使它可以在 Chrome、FF 中工作。
大约 12 个月前,我使用 GWT 2.0 创建了一个应用程序,并注意到它有时停止工作。我将其剥离回最初的类,似乎每次我调用 History.addValueChangeHandler 时,Internet Explorer 都会崩溃。
这是代码:
package com.js.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.History;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class Test implements EntryPoint, ValueChangeHandler<String>
{
/**
* This is the entry point method.
*/
public void onModuleLoad() {
History.addValueChangeHandler(this);
History.fireCurrentHistoryState();
}
public void onValueChange(ValueChangeEvent<String> event) {
Label loading = new Label( "Loading..." );
RootPanel.get().add( loading );
}
}
很难相信这会崩溃,但这是错误:
18:50:52.407 [ERROR] [test] Unable to load module entry point class com.js.client.Test (see associated exception for details)
com.google.gwt.core.client.JavaScriptException: (Error): Access is denied.
description: Access is denied.
number: -2147024891
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:195)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.user.client.impl.HistoryImplIE6.getTokenElement(HistoryImplIE6.java)
at com.google.gwt.user.client.impl.HistoryImplIE6.init(HistoryImplIE6.java:80)
at com.google.gwt.user.client.History.<clinit>(History.java:63)
at com.js.client.Test.onModuleLoad(Test.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:369)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:185)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:380)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
at java.lang.Thread.run(Unknown Source)
任何帮助将不胜感激。谢谢!
I am having trouble getting the Google Web Toolkit's History class to work in Internet Explorer, even though it works in Chrome, FF.
I created an app using GWT 2.0 about 12 months ago, and noticed it stopped working sometime. I stripped it back to just the very first class and it seems any time I call History.addValueChangeHandler, Internet Explorer crashes.
Here is the code:
package com.js.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.History;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class Test implements EntryPoint, ValueChangeHandler<String>
{
/**
* This is the entry point method.
*/
public void onModuleLoad() {
History.addValueChangeHandler(this);
History.fireCurrentHistoryState();
}
public void onValueChange(ValueChangeEvent<String> event) {
Label loading = new Label( "Loading..." );
RootPanel.get().add( loading );
}
}
It's hard to believe this could crash, but here is the error:
18:50:52.407 [ERROR] [test] Unable to load module entry point class com.js.client.Test (see associated exception for details)
com.google.gwt.core.client.JavaScriptException: (Error): Access is denied.
description: Access is denied.
number: -2147024891
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:195)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.user.client.impl.HistoryImplIE6.getTokenElement(HistoryImplIE6.java)
at com.google.gwt.user.client.impl.HistoryImplIE6.init(HistoryImplIE6.java:80)
at com.google.gwt.user.client.History.<clinit>(History.java:63)
at com.js.client.Test.onModuleLoad(Test.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:369)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:185)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:380)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
at java.lang.Thread.run(Unknown Source)
Any help would be appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是IE7吗?您是否使用 JSP/Servlet 来呈现主页?如果是,请确保您的 servlet 生成带有双引号而不是单引号的历史 iframe/脚本代码。
Is this IE7? Are you using a JSP/Servlet to render your home page? If yes ensure your servlet generates the history iframe/script code with double quotes and not single quotes.