PDA

View Full Version : beforeunload event is not triggered



andrucz
4 Sep 2014, 12:40 PM
Hello.

I'm registering an event handler to window object this way: Ext.EventManager.on(window, 'beforeunload', beforeUnloadEvent);

In some cases, when an user clicks in a button that opens a new Ext.Window and immediately closes the browser, before the modal window is completely loaded, the event is not triggered and "beforeUnloadEvent" is not called.

It does not happens every time. Usually does when the interval between clicking in the button and closing the browser is really small.

I would like to know if this is, probably, a bug of the browser (it happened in IE 10) or a ExtJs bug.

Thanks!

slemmon
9 Sep 2014, 9:50 PM
It's sounding like a racing condition especially if it's intermittent.
Do you have a test case you could share that demonstrates the issue that folks can test along with you?

andrucz
10 Sep 2014, 2:46 AM
I've found the reason: https://stackoverflow.com/questions/20188653/onbeforeunload-event-not-executed-when-the-page-is-closed-during-javascript-runn

Thanks for your help!