Unfortunately you have to use the "built in" window.onbeforeunload method.
Yes it does look like crap but it's the standard box and if the browsers allowed you to just do anything when someone tried to close a window it would be more of a security risk (think uncloseable windows). The only time you "have" to use the onbeforeunload is to handle the user either closing the window on using some of the other browser buttons (back, forward, etc). For everything else you can get away with tagging each link (or button) on the page with a handler that checks to see if it should put up a dialogue. Karl Rudd On Mon, Nov 10, 2008 at 10:51 AM, manwood <[EMAIL PROTECTED]> wrote: > > Hi All > > I am trying to warn a user about unsaved changes when they attempt to > leave a page. I can catch and prompt using the built in OnBeforeUnload > dialog, but it looks sh*t and has some annoying standard text that is > of no use to me. I have tried to bind to the BeforeUnload event using > jQuery in order to show a modal dialog, but I cannot find any way to > get it working. Is it even possible? > > Thanks for any advice. > > :) >