I am writing an Ext JS 5 application and seem to be losing a reference to a child window that I am opening.
The following opens a new window to w3schools, as a sample. Later, when I close the window, the beforeunload event DOES NOT fire.
this.chatPopOutWindow = window
.open(
'http://www.w3schools.com',
'chatPopOutWindow',
'width=380,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no');
Ext.get(me.chatPopOutWindow).on('beforeunload', function() {
.....more code
In this code sample with a bad url (the new window opens to a 404 error), when I close the window the beforeunload event DOES fire:
this.chatPopOutWindow = window
.open(
'/someBadURL',
'chatPopOutWindow',
'width=380,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no');
Ext.get(me.chatPopOutWindow).on('beforeunload', function() {
.....more code
Why does the beforeunload event not get triggered in the first scenario?