Can I implement an onbeforeunload function in this way?
window.onbeforeunload = function(evt) {
if(return true)
{
if(confirm('Are you sure you want to logout'));
{
//logout function
}
}
}
If a user clicks on the "leave this page" button, I want to prompt them to logout of the session. Is this achievable?