I am using GWT 1.5 and want to manage history. Whenever I call
History.newItem(token), Mozilla displays the window title in history
list But Internet Explorer shows  
http://localhost:8888/com.TestEntry/8DF40326B05334ADE3B6DCA8E9DD3DA2
in the list i.e. URL of my page instead of showing window title. When
I drilled, I noticed an issue in HistoryImplIE6's newItemImpl method.
It was written as below:

  protected native void newItemImpl(Element historyFrame, String
historyToken, boolean forceAdd) /*-{
    historyToken = historyToken || "";

    if (forceAdd || ($wnd.__gwt_historyToken != historyToken)) {
      var doc = historyFrame.contentWindow.document;
      doc.open();
      doc.write('<html><body onload="if(parent.__gwt_onHistoryLoad)
parent.__gwt_onHistoryLoad(__gwt_historyToken.innerText)"><div
id="__gwt_historyToken">' + historyToken + '</div></body></html>');
      doc.close();
    }
  }-*/;

It adds an IFrame without specifying title tag.
If IFrame does not have title then it will display the complete URL in
history list. For a solution, I applied a patch in this class where I
took the window title and put it into head tag as below:

  protected native void newItemImpl(Element historyFrame, String
historyToken, boolean forceAdd) /*-{
    historyToken = historyToken || "";

    if (forceAdd || ($wnd.__gwt_historyToken != historyToken)) {
      var doc = historyFrame.contentWindow.document;
      doc.open();
 var windowTitle = $wnd.document.title;
      doc.write('<html><head><title>'+windowTitle+'</title></
head><body onload="if(parent.__gwt_onHistoryLoad)
parent.__gwt_onHistoryLoad(__gwt_historyToken.innerText)"><div
id="__gwt_historyToken">' + historyToken + '</div></body></html>');
      doc.close();
    }
  }-*/;

and now IE is also showing window title in History list.

Now my question is: is it a bug of GWT ? And is there any other
alternate for this so that I need not to make a patch in GWT's jar.
Any help or suggestion in this regard will be highly appreciated.

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to