Click to See Complete Forum and Search --> : Can you help?


RobMillray
01-15-2004, 09:54 AM
Hi,

I'm writing a web application using IE6 where I need to be able to differentiate between navigation away from my page (back button, new URL) and the browser being closed.

The problem is both actions trigger the onbeforeunload and onunload events but don't give any indication of what action triggered the event.

I need to display a message if the window is closed but not if the back button is clicked.

One of the Microsoft support guys tried to write a script to get around this problem but it only works if the google toolbar is installed?!

Any ideas?

Cheers,

Fang
01-15-2004, 11:16 AM
It's not foolproof, but if you polled the mouse coordinates,
the value of offsetX would be very low for the "back" button
and high for "close".
It won't help with keyboard entries of course.