GWT历史记录JavaScript无法在Internet Explorer中运行 [英] GWT History JavaScript Not Working in Internet Explorer
问题描述
我无法让Google Web Toolkit的历史记录类在Internet Explorer中正常工作,即使它在Chrome FF中也可以正常工作.
I am having trouble getting the Google Web Toolkit's History class to work in Internet Explorer, even though it works in Chrome, FF.
大约12个月前,我使用GWT 2.0创建了一个应用程序,并注意到它有时停止工作.我将其剥离回到了第一堂课,似乎每当我调用History.addValueChangeHandler时,Internet Explorer就会崩溃.
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.
这是代码:
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!
推荐答案
这是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.
这篇关于GWT历史记录JavaScript无法在Internet Explorer中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!