title: how to stop default behavior of onbeforeunload and do my own functionality
body: <p>how to handle the red close icon in the browser and tab close. I need to do some functionality on closing of the browser. But it should not effect the refresh and also how do I differentiate the browser close icon and tab close icon.</p>