Detect Browser or Tab Close Event in jQuery or Javascript

If user directly close the broswer window without logout or saving the information, then you need to detect browser close event to update the user status. We can manage this functionality via beforeunload event.

To find the browser or tab close event can be identfied by using ‘onbeforeunload’ event in javascript and in jQuery can use ‘beforeunload’ event.

Detect Browser Close Event in jQuery:

In Javascript:

 

Recommended Posts For You

About Harish

I am professional web developer and blogger. Use this blog to share own api and other web development experience with you. I do accept paid work. Write to me at - [email protected]

View all posts by Harish