What I want to do is, to fire some function, only when user tries to close browser window by clciking on x button. But not on refresh, "back" button click events like following function does.
$(window).unload( function () { alert("Bye now!"); } );
So is there any way to achieve this? Thx in advance