2011-09-27 56 views
1

即使在Chrome,FF中工作,我仍無法使Google Web Toolkit的歷史記錄類在Internet Explorer中工作。GWT歷史記錄JavaScript在Internet Explorer中不工作

我在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) 

任何幫助,將不勝感激。謝謝!

回答

0

這是IE7嗎?您是否使用JSP/Servlet來呈現您的主頁?如果是,請確保您的servlet使用雙引號生成歷史記錄iframe /腳本代碼,而不是單引號。

+0

7和8沒有工作,也沒有兼容模式。 9也不工作。 今天我將要嘗試GWT 2.4,看看這是否會改變任何事情。它可能只是我的項目,我以爲我試過創建一個新的,但因爲所有的eclipse設置和它引用的庫,我認爲我做錯了。 我沒有使用servlet頁面是帶雙引號的HTML。我只用我自己的CSS來使用股票標準頁面。 – Spacey

+0

確定與GWT2.4和新eclpise它在IE8中工作,但不是在兼容模式下。不知道爲什麼。 – Spacey

相關問題