On Thu, Apr 2, 2009 at 7:29 PM, Thomas Broyer <[email protected]> wrote:

>
>
>
> On 3 avr, 00:43, Vitali Lovich <[email protected]> wrote:
> > Here's the problem:  This is the way you normally popup a confirmation
> > dialog.
>
> ...when the user navigates *away* from your app, not *within* your app
> (which doesn't involve "unloading" the page, as GWT apps are "one-page
> apps")
>
> > The problem, if I'm not mistaken (I haven't looked into history in a
> while),
> > is that history is done through a hidden iframe,
>
> Only for IE, on other browsers it just sets $wnd.location.hash (modulo
> some tweaks/hacks to workaround a few bugs here and there)
>
> > thus when the user hits
> > back, it's quite possible that the window close event won't get generated
> > (the browser will simply load the iframe).
>
> When navigation *within* your app, the HTML page isn't "unloaded", so
> I can assure you that the "window close" event (actually
> onbeforeunload and onunload at the javascript level) won't be called
> (except in some rare cases in IE, after you typed a new history token
> in the location bar, AFAICT)
>
> > Try & see if it works.  If it doesn't, then you'll have to actually
> extend
> > the GWT code itself (History.java) to add this feature.  Shouldn't be too
> > difficult.
>
> Oh yes it'll be. It wouldn't be hard adding a confirm dialog before
> newItem(), back() or forward() is actually called (but you coul just
> do that from your code, eventually wrapping History methods within
> your own history class); but when reacting to changes in response to
> the browser's back/forward buttons/menu items, the token will already
> have changed and you won't know whether it was because of a "back",
> "forward" or "typed into location bar" (or "from a bookmark") action,
> so you could eventually prompt the user, but you won't know for sure
> what to do next (forward() ? back() ? and you cannot "explore" the
> history to see what URL would get before/next)

Why not use cookies as well to keep track of the previous state within your
wrapper?  That way even when it gets changed out from under you, you'll have
access to the entire history.


>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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