How to capture the browser close event in web applications?

When the web application is running and closes the browser window, what event is called?

+1


source to share


4 answers


onunload is an event that fires when the browser window is closed.



More than ever, this event is never triggered only when the browser is closed, this is just one case.

+1


source


The web browser does not send notifications to the web server when the user approaches the window.



0


source


You may also be interested in onbeforeunload .

0


source


Check out my answer on the topic noted by Diodeus: Basically you can't ... Many browsers no longer fire onbeforeunload and / or onunload. And even when it does, it is difficult to distinguish between page reloading, page switching and browser / window / tab closing.

0


source







All Articles