I am using this code for logging out user when closes the page, but the user will logout also when clicking on other links (same website):
$( window ).unlo
Try the following solutions, hope this helps
or
var logOutFlag = true; $('a').click(function(){ logOutFlag = false; }); $(window).bind('beforeunload', function(event) { if(logOutFlag){ $.ajax({url:"?logout&leave=yes", async:false}); } });