I want to send an ajax request only when the browser window closes not on refresh or reload. I am using this code.
DisplayExit = function() {
simpleAjaxReq("formatter_main.php",'file_close' , 'true');
};
window.onbeforeunload = DisplayExit;
This works when closing the browser window but also execute the code when the page reloads, is there a way for this code to only works on close not reload.