I am working in a web application which automatically logs you out after a set amount of inactivity. I have no control over the application. The relevant code the application uses to logout is here:
var windoc = window.document;
var timeoutID;
function AlertUser() {
var msg = 'Session expires in 90 seconds. Continue with this session?';
var preConfirmTime = new Date();
if (confirm(msg)) {
var postConfirmTime = new Date();
if (postConfirmTime.getTime() - preConfirmTime.getTime() > 90000) {
alert('Sorry, your session has already expired.');
window.location = '/Logout.aspx';
} else {
var img = new Image(1,1);
img.src = '/Reconnect.aspx';
timeoutID = window.setTimeout('AlertUser()','3510000');
}
} else {
window.location = '/Logout.aspx';
}
}
function ResetTimeout(delay) {
window.clearTimeout(timeoutID);
timeoutID = window.setTimeout('AlertUser()', delay);
}
timeoutID = window.setTimeout('AlertUser()','3510000');
Since the logouts are really breaking my workflow, I would like to have a bookmarklet that confirms OK
whenever the session is about the expire. I thought I might use
javascript:window.confirm = function(){return true;};
But this only runs when I click the bookmarklet. Is there any way to make it run in the active (IE 10) browser tab automatically (so also if I open a new tab with the application) and make it check continuously? By the way I can not install any browser extensions. The only way of interacting with webpages is via a bookmarklet.