I tried window.onbeforeunload
but it doesn't seem to work. Any help?
I have a cookie that tracks if the user logged in.
function handleLoginRegSuccess(){
$.cookie('loginStatus', "ON", { expires: 1, path: '/'});
showBusyMessage();
goToIndex();
}
This is what I tried, but it doesnt work.
window.onbeforeunload = function(e) {
if(userLoginStatus()=="ON"){
requestLogout();
$.removeCookie('loginStatus');
return "test";
}
};