I have found many code to detect the close button of the browsers but I got event when calling close tab. I just want to get the main close button event to alert the user to stay in this page or not. I found this code.I have found many code to detect the close butt