||View All MessagesBack to WebFX|
I'm using onbeforeunload to check for unsaved changes.
It throws a dialog that you cannot (AFAIK) get a true/false from because you set the returnvalue to the message you want in the dialog box. On OK it will go to the location you've asked for, and on cancel it stays on this page.
There is no way apart from the readyState thing I've found for IE that will tell you what the user has chosen.
In my case I have some reasonably complicated stuff going on - but at its simplest you may want to start or stop a loading animation.
I thought about combining onunload with onbeforeunload and using a timeout - but that is incredibly flaky because onunload fires when the new page starts to load which can be a while after onbeforeunload.