On 15 avr, 21:21, davidroe <roe.da...@gmail.com> wrote:
> usual problem with IE6 not behaving like any other browser. this one
> is relatively blatant. I have included the code to a new project
> created in 1.4 that has a history listener and not much else.
>
> if I click on the link, which sets the history token to #link1, the
> page reloads and onModuleLoad is called
> if I click on the button, which calls History.newItem("link2"),
> everything works as expected and onHistoryChanged is called.
>
> is there anything I can do to prevent IE6 reloading the entire page?
Hook a ClickListener in the link an call History.newItem from it.
That's what the Hyperlink widget does FWIW.
> ----------------------------- 8< -----------------------------
>
> package com.mypackage.client;
>
> import com.google.gwt.core.client.EntryPoint;
> import com.google.gwt.user.client.History;
> import com.google.gwt.user.client.HistoryListener;
> import com.google.gwt.user.client.Window;
> import com.google.gwt.user.client.ui.Button;
> import com.google.gwt.user.client.ui.ClickListener;
> import com.google.gwt.user.client.ui.HTML;
> import com.google.gwt.user.client.ui.RootPanel;
> import com.google.gwt.user.client.ui.Widget;
>
> public class IETest2 implements EntryPoint, HistoryListener {
>
> public void onModuleLoad() {
>
> Window.alert("onModuleLoad");
>
> HTML h1 = new HTML("<a href=\"#link1\">link1</a>",true);
> Button b2 = new Button("link2");
> b2.addClickListener(new ClickListener() {
> public void onClick(Widget sender) {
> History.newItem("link2");
> }
> });
>
> History.addHistoryListener(this);
> RootPanel.get("slot1").add(h1);
> RootPanel.get("slot2").add(b2);
>
> }
>
> public void onHistoryChanged(String token) {
> Window.alert("onHistoryChanged");
> }
>
>
>
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---