Here is my JS code which will be executed when close the browser or the tab. Which will makes the user status as offline before closing the browser
function checkBrowser(){
function warning(){
if($('#loginOrNot').val() == 'loggedIn'){
setTheExpertStatusToOffline();
cleanUpChat();
alert("You are leaving the page");
}
}
window.onbeforeunload=warning;
}
on documnet.ready() am calling checkBrowser() method, so that it will bind the function for browser close. Now the problem is this is working perfectly fine in all browsers but not in Chrome. Whats wrong in here?