I have observed onUnload being called multiple times. I suspect, but have not been able to confirm, this happens when the pop-up window follows a redirect (attempts to debug with chrome devtools result in the behaviour changing).
In our application, we need to trigger certain actions when the popup closes, and this multiple triggering is causing those actions to be run prematurely. Ideally, onUnload would only be called when the pop-up actually closes, but this may be hard to achieve. If the child window was passed to the onLoad callback, one work-around would be to look at the child window.location.href, and only trigger those actions when the child window has reached it's final state.
I have observed onUnload being called multiple times. I suspect, but have not been able to confirm, this happens when the pop-up window follows a redirect (attempts to debug with chrome devtools result in the behaviour changing).
In our application, we need to trigger certain actions when the popup closes, and this multiple triggering is causing those actions to be run prematurely. Ideally, onUnload would only be called when the pop-up actually closes, but this may be hard to achieve. If the child window was passed to the onLoad callback, one work-around would be to look at the child window.location.href, and only trigger those actions when the child window has reached it's final state.