Javascript: Confirm closing/unloading the page with the javascript event onbeforeunload
In some scenarios, it is good to ask the user for confirmation if he really wants change pages and therefore lose all data entered in a form. This can be handy when the form is time consuming. For this, there is a DOM event beforeunload which occurs just before unloading the page. The return value is the text that is displayed ...more»