GWT History JavaScript Not Working in Internet Exp

2019-08-15 09:34发布

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!

1条回答
孤傲高冷的网名
2楼-- · 2019-08-15 10:25

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.

查看更多
登录 后发表回答