javascript onbeforeunload Description

Fires just before the current document begins to unload due to impending navigation to a new page, form submission, or window closure. This event fire