BeforeUnloadEvent
The beforeunload event is fired when the window, the document and its resources are about to be unloaded.
The beforeunload event is fired when the window, the document and its resources are about to be unloaded.