Search code examples
javascriptfirefox4onbeforeunload

Why is Firefox 4 triggering the beforeunload event twice?


I have a web page which catches the 'beforeunload' event to put up a confirmation dialog for the user. In Firefox 4 and 5 I am finding that, when closing the page would also close the browser, this dialog is coming up twice. Furthermore, if the user clicks 'Stay on page' the second time, the browser then no longer allows individual tabs to close. You can still shut down the entire browser though.

I presume this is a Firefox bug, but is there any workaround?


Solution

  • yes it is a bug see here https://bugzilla.mozilla.org/show_bug.cgi?id=619857

    I'm also in the middle of finding a work around i will inform you if i get to know one.