I have a page where I need to perform a task on unload but only when the page is closed. The problem I am having is that the unload also runs when refreshing (or postback) the page which will cause problems.
This is what I am using to test the event at the moment:
$( window ).unload(function() {
alert( "Bye now!" );
});
I need to use a similar function but not when the page is refreshed or a postback has occurred.