Here I want to logout an user when they close the browser. For that I have done R&D and found that the following code will fire when we close the browser.
window.onbeforeunload = function() {
myService.logout();
return 'Your own message goes here...';
}
Here when I try to close the browser this event will fire and it will make the user to logout. But here the problem is when the page is redirected that time also this event is firing.
I want to use this function to make the user to logout.But it is going wrong.Please help me to do this functionality.