I searched for this question in various places, but all that they mention is the use of javascript window.unload & window.onbeforeunload. Also it doesn\'t
I tested and the example posted on MDN works clearly in Chrome.
...
This way a dialog opens that will not be blocked by a popup blocker as it is originated from a user click.