The question is
How to show a confirmation box on closing a browser window ?
This question has been asked many times before, and previous answers, such as https://stackoverflow.com/a/333673/1442181 suggest to use the onbeforeunload
event.
But, according to http://developer.mozilla.org/en-US/docs/Web/Events/beforeunload, "browsers may not display prompts created in beforeunload event handlers unless the page has been interacted with, or may even not display them at all."
I have a preview page after the user has filled some form, and I would like to show a confirmation prompt when the user leaves the page (except by clicking "back to edit" or "submit"). The preview page cannot be interacted with, so previous solutions seem to not work e.g. in the current firefox version.
(How to avoid the prompt on these two links is not part of the question and answerred in detail elsewhere.)