Over a million developers have joined DZone.
Platinum Partner

Detect Event Of Browser Close Button When [X] Is Clicked

· Web Dev Zone

The Web Dev Zone is brought to you by Stormpath—offering a pre-built Identity API for developers. Easily build powerful user management, authentication, and authorization into your web and mobile applications. Download this Forrester report on the new landscape of Customer Identity and Access Management.

Some times we need to detect the Browser Close to perform some operation before quiting from application. Here is a simple way.


Call this Method From Body Unload


function CheckBrowser()

{

// Check Browser Close [X] , Alt+F4 , File -> Close

if(window.event.clientX Spring Framework

The Web Dev Zone is brought to you by Stormpath—offering a pre-built, streamlined User Management API for building web and mobile applications. Check out our top pointers for designing your REST API.

Topics:
spring

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}