Ads 468x60px

Pages

Blogroll

Wednesday, December 21, 2011

Control Logout on Direct Browser close

document.onkeydown = function (e) {
var evtobj = window.event ? window.event : e
LastKeyPressCode = evtobj.keyCode;
}

$(window).unload(function () {
alert('Handler for .unload() called.');
});

onbeforeunload = function () {
if (UserId != 0) {
SaveViewerSettings();
}
if (document.getElementById('uxReloadFlag').value != 'true' && LastKeyPressCode != 116 && LastKeyPressCode != 82) { //116 is for refresh key (F5) - Do not exit user on refresh - F5
ExitLiveSession(LiveSessionId, UserId, false);
}
}

0 comments:

Post a Comment