History list problem in IE6 - Do I really need to patch GWT's jar

11 views
Skip to first unread message

Ganesh

unread,
Nov 17, 2008, 11:29:34 PM11/17/08
to Google Web Toolkit, rohit....@daffodilsw.com
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.

Regards

Ganesh Bansal

Ganesh

unread,
Nov 19, 2008, 2:13:31 AM11/19/08
to Google Web Toolkit
Hello Friends

Can anyone confirm if I am doing right for managing history or is
there any other alternate for avoiding this patch ?

Regards

Ganesh Bansal

Sumit Chandel

unread,
Nov 20, 2008, 5:41:53 PM11/20/08
to Google-We...@googlegroups.com
Hi Ganesh,

I believe the problem you're experiencing is due to the fact that you forgot to include a required iframe on your host HTML page. Specifically, the GWT History mechanism uses an <iframe> trick to correctly support history in IE6.

Try adding the following iframe in the body of your host HTML page:

<iframe src="javascript:''" id="__gwt_historyFrame" style="position:absolute;width:0;height:0;border:0"></iframe>

That should solve the problem without needing to hack the HistoryImplIE6 class.

Hope that helps,
-Sumit Chandel

Ganesh

unread,
Nov 20, 2008, 11:11:55 PM11/20/08
to Google Web Toolkit
Hello Sumit

Thanks for your reply.

I have already added this <iframe> tag in my host HTML page with a
difference that "position:absolute" is missing. I don't think it
should affect history working but still I will try using this tag in
my <iframe> tag and update you shortly.

I am explaining my problem once more if I was not able to do it
properly before.

Problem: In IE6, although history is being maintained, but the node
which is being added in browser's history list (list which is shown
while pressing down button located along with back button), is showing
link/URL of the page instead of showing title of the window. While
it's working fine in Chrome & Mozilla. For resolving this, I need to
hack in HistoryIE6Impl class as given in previous post.

Kindly let me know if I need to explain more. (In the mean time, I am
trying position tag and will update you accordingly.)


Regards

Ganesh Bansal

On Nov 21, 3:41 am, Sumit Chandel <sumitchan...@google.com> wrote:
> Hi Ganesh,
>
> I believe the problem you're experiencing is due to the fact that you forgot
> to include a required iframe on your host HTML page. Specifically, the GWT
> History mechanism uses an <iframe> trick to correctly support history in
> IE6.
>
> Try adding the following iframe in the body of your host HTML page:
>
> <iframe src="javascript:''" id="__gwt_historyFrame"
> style="position:absolute;width:0;height:0;border:0"></iframe>
>
> That should solve the problem without needing to hack the HistoryImplIE6
> class.
>
> Hope that helps,
> -Sumit Chandel
>

Ganesh

unread,
Nov 20, 2008, 11:43:48 PM11/20/08
to Google Web Toolkit
Hello Sumit

I tried adding "position:absolute" in <iframe> but same result as
before. Now waiting for your reply....

Regards

Ganesh Bansal

Danny Schimke

unread,
Nov 21, 2008, 1:55:09 AM11/21/08
to Google-We...@googlegroups.com
Which Doctype are you using? Standard-mode or Qirks-mode? Try Standard-mode in your HTML-file, if you havn't yet... (<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">).

2008/11/21 Ganesh <ganesh...@gmail.com>
Reply all
Reply to author
Forward
0 new messages