onbeforeunload event is fired twice

R

Rick Lubanovic

I have been working on a script to check if a page has
changed before the user leaves the page. I have a call to
a javascript function on the onbeforeunload event.

This seems to work in most cases. However, in my
testing, the onbeforeunload event is sent twice. This
causes problems in certain cases where I want to suppress
the "The page has changed" message, as in the case
of a "Cancel" button being hit.

This is a similar problem to the one discussed
10/17/2003 in:
"need JavaScript to prevent people from closing a browser
window"

I am using C# with ASP.Net version 1.1, and my HTML is
within a frameset.

Any help would be greatly appreciated. If there is a
workaround to "eat" the second event, that might work.

Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top