window.beforeunload called twice in Firefox - how to get around this?
Posted
by Zarkonnen
on Stack Overflow
See other posts from Stack Overflow
or by Zarkonnen
Published on 2009-11-26T00:50:45Z
Indexed on
2010/04/07
17:03 UTC
Read the original article
Hit count: 393
I'm creating a popup window that has a beforeunload handler installed. When the "Close" file menu item is used to close the popup, the beforeunload handler is called twice, resulting in two "Are you sure you want to close this window?" messages appearing.
This is a bug with Firefox, and I've reported it here, but I still would like a way to prevent this from happening. Can you think of a sane way of detecting double beforeunload to prevent the double message problem? The problem is that Firefox doesn't tell me which button in the dialog the user elected to click - OK or cancel.
© Stack Overflow or respective owner