window.onbeforeunload = logout;
function logout()
{
window.location.href = "logout URL";
}
How can we write asynch method for this code? Only by using setTimeout or any other?
Thanks in Advance
window.onbeforeunload = logout;
function logout()
{
window.location.href = "logout URL";
}
How can we write asynch method for this code? Only by using setTimeout or any other?
Thanks in Advance
As i understand
onbeforeunload is supported by most browsers. Even opera in the newever versions.
If you want to catch the event
Source: Crossbrowser onbeforeunload?
window.onbeforeunload = function (e) {
var e = e || window.event;
// For IE and Firefox
if (e) {
e.returnValue = '';
}
// For Chrome and Safari
return '';
};
Extra: