On 17 sep, 06:09, Brice <[EMAIL PROTECTED]> wrote:
> Good evening. I am working on a new GWT app and I noticed a few
> strange behaviors in IE 7 that I didn't see in FireFox / Safari.
> Particularly that a link with a #token will cause a page refresh if
> its in my wrapper HTML, but not if its generated by GWT. This doesn't
> happen (from what I can see) in FireFox / Safari.
>
> Here's the scenario: my wrapper HTML has been designed externally, the
> GWT just renders into the content area of the page. Outside of this
> area are two "tabs". Instead of linking to different pages, the hrefs
> are #tabA and #tabB. After the GWT EntryModule has run, this *should*
> just fire History changed events, right? That's what it does in FF and
> Safari. In IE, it reloads the page, and since my EntryModule invokes
> fireCurrentHistoryState(), the right state is initialized.
>
> Within the GWT module, links are rendered with tokens, too. When these
> are clicked, the page does not reload. As expected, the History
> changed event is fired, and the new application state is loaded.
>
> Am I going about this incorrectly? Is this an IE ideosyncracy?

Yes (search the issue tracker, this has been reported recently –maybe
it was you?–)

> Is there a workaround?

Attach onclick handlers to your links to call History.newItem and
Event.preventDefault(). That's what GWT's Hyperlink do to workaround
this IE "quirk".

To attach the onclick, you could loop through the
Document.get().getElementsByTagName("a") (before attaching your GWT
widgets) and call DOM.setEventListener and DOM.sinkEvents.
However, I'd rather expose the History.newItem method as a global JS
function through JSNI and attach the onclick handlers in the host page
HTML: <a href="#tab1" onclick="GWT_History_newItem('tab1'); return
false;">

Another option is to just have placeholders in your HTML host page and
"inject" GWT Hyperlinks in there (RootPanel.get("tab1link").add(new
Hyperlink("Tab 1", "tab1"))).

...if only there were a SimpleHyperlink widget with a static wrap()
method to wrap an <A HREF> and set the EventListener automatically...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to