Yeah, this will work but only for IE and Firefox. For other browsers (opera, safari) there is no way to get this event i'm affraid.
-Matej On 5/21/07, Flavius <[EMAIL PROTECTED]> wrote: > > > Thanks Martijn. > > getBodyContainer().getBodyContainer().add(new AjaxEventBehavior("onunload") > { > protected void onEvent(AjaxRequestTarget target) > { > //handle cleanup here > } > }); > > This works well, except it doesn't fire when the browser is closed. > I'm keeping a ref to uploaded files in a list on the session. When > valueUnbound fires in my session, any remaining files that have > not been handled can be removed then. > > That should cover BSOD, and any other client issues. > > > > > > Martijn Dashorst wrote: > > > > body.onunload could be your friend > > > > However, don't depend on this behavior to be a failsafe: kill -9 will > > not trigger the body onunload in the browser, or a power failure on > > the client side, or a BSOD, or ... > > > > Martijn > > > > On 5/18/07, Flavius <[EMAIL PROTECTED]> wrote: > >> > >> I would like to receive an event when the user tries to navigate > >> away from the current page. > >> > >> So if the user is on the page and navigates to any other page, closes > >> the window, etc., I'll get an event. > >> > >> I have a page that allows the user to upload files to a record. I store > >> the physical file in a temp location until the record is saved. If they > >> navigate away / close the window without saving, I want to be able > >> to delete the uploaded files on the fly. > >> > >> Also, later, I may want to keep a dirty flag on the page. So if the > >> user has not made any changes, it will just navigate away. But if > >> they have dirty changes, it will prompt them with an alert box. > >> > >> I was looking at the source for ModalWindow. It seems that I can > >> probably attach a behavior to page. I'd thought I'd ask to see > >> if that's the best approach. > >> > >> Currently I am using wicket 1.2.6 on Tomcat 5.5 > >> -- > >> View this message in context: > >> http://www.nabble.com/Receive-event-when-user-navigates-away-from-current-page-tf3779542.html#a10688196 > >> Sent from the Wicket - User mailing list archive at Nabble.com. > >> > >> > >> ------------------------------------------------------------------------- > >> This SF.net email is sponsored by DB2 Express > >> Download DB2 Express C - the FREE version of DB2 express and take > >> control of your XML. No limits. Just data. Click to get it now. > >> http://sourceforge.net/powerbar/db2/ > >> _______________________________________________ > >> Wicket-user mailing list > >> Wicket-user@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/wicket-user > >> > > > > > > -- > > Learn Wicket at ApacheCon Europe: http://apachecon.com > > Join the wicket community at irc.freenode.net: ##wicket > > Wicket 1.2.6 contains a very important fix. Download Wicket now! > > http://wicketframework.org > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > -- > View this message in context: > http://www.nabble.com/Receive-event-when-user-navigates-away-from-current-page-tf3779542.html#a10723397 > Sent from the Wicket - User mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user