Is it possible to write onbeforeunload function like this?
window.onbeforeunload = function(evt) {
if(return true)
{
if(confirm('Are you sure you want to logout'));
{
//logout function
}
}
}
If user click on the "leave this page" button I want to ask user to logout the session. Is it possible?