onbeforeunload event is fired twice

  • Thread starter Thread starter Rick Lubanovic
  • Start date Start date
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
 
Back
Top