That means, if the user manually closes the browser window,
then that function should be called just before closing that window.
I tried html body "onunload" to call the function, but not working.
posted 3 years ago
There is no real way of knowing if the person closes the window, refreshed the window, or navigates to a new page.
If you are trying to clean up a session on the server, that is what the session end events is for.