Thanks your answers. I now have another question... The code below displays a confirmation to leave the page with button "ok" (the close action completes) and "cancel" (stop the close event). How do I know which button the user actually clicked on? Is there a way to assign a callback function to process user's selection?
I would like to clean up the session if and only if the user actually exits the browser window... Thanks Window.addWindowClosingHandler(new ClosingHandler() { public void onWindowClosing(ClosingEvent event) { event.setMessage("Really want to leave?"); } }); On Oct 9, 3:19 pm, Chris Ramsdale <cramsd...@google.com> wrote: > Brian is correct, have your application implement Window.ClosingHandler > and/or Window.CloseHandler in order to do any clean up work when the user > navigates away from your site. > Keep in mind that:1. These events are called when the user closes the > browser or tab as well as when the user navigates away from your site.) > 2. No user-interface components may be displayed during this event (see link > below). > > Instead of displaying UI during close, you may want to consider cleaning up > any session data and having the user re-authenticate when they return. > > ClosingHandler interface > JavaDoc:http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/g... > > - Chris > > On Wed, Oct 7, 2009 at 3:17 PM, Brian Blain <bbla...@gmail.com> wrote: > > > Maybe Window.addWindowClosingHandler or Window.addCloseHandler > > > On Oct 7, 11:35 am, francescoNemesi <nem...@yahoo.com> wrote: > > > Hi, > > > > is there a way to listen to a browser window or unload event? I want > > > to force a logout (to clean up session memory on the server as well as > > > much as I can on the client) if the user forgets to logout explicitly > > > before closing the browser or navigating to another page. > > > > Thanks, > > > F --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---