I have a problem with
beforeunload events not being fired for child windows when closing/reloading the parent window.
I am developing a multi-window Electron app, in which the child windows are opened by clicking regular HTML links with the
target="_blank" attribute. Each created
BrowserWindow (parent and children) has a preload script that assigns the
onbeforeunload event handler. Now, when the parent window is closed/reloaded, all the child windows are closed, but only the parent handler is executed. I am wondering whether this is the expected behaviour.
I have created a simplified gist showing the problem: https://gist.github.com/wmatyjewicz/1fc71fcfc3ff49ff503a77f50d97a449
If you open a few child windows by clicking the “Child” link and then close parent window, you will get only one
beforeunload notification (in the form of a message box). Is it possible to get one event per window?