At our job we're using a communication portal that logs out after a while. Some of my co-workers asked me for a javascript, that disables the autologout. All i could achieve was to reset the displayes timer, but the timer itself keeps running anyway. Here is how the timer is started:
<body class='asam_body' onLoad='window.setTimeout("DsplTime()",1);' >
As you can see, setTimeout is called at onLoad, but there is no reference to the setTimeout-call, so i can't use the clearTimeout() function. I've also tried to call DsplTime() out of my script, but that still doesn't stop the timer. Everything i found doesn't apply to my case, so i gave up my search after two hours. Is there any way to influence this serverside body-definition, e.g. by
- overriding the onLoad (tried with @document-start)
- replacing the string for the definition of the body itself (i guess because the server delivers that, its to late for my script to inject, when the line is there)
- getting a reference to the setTiming-Object retroactively
Here's my rather useless approach, that only resets the displayed time:
setInterval(CalcTime, 130000);
setInterval(resetStart, 130000);
setInterval(DsplTime, 130000);
//resetStart and CalcTime are prefined functions,
// without any impact on the timer itself, unfortunately
Thanks in advance!
P.S.: thats the first time i asked something on stackoverflow, so i hope, i asked appropiately:)
Edit:
I tried the brute force approach from Cancel all Javascript's setTimeouts and setIntervals, with
for (var i = 1; i < 99999; i++) {
window.clearInterval(i);
window.clearTimeout(i);
window.mozCancelAnimationFrame(i); // Firefox
}
But still i'm logged out after the same amount of time.
This codesnipped leads to the logout after 1440 minutes:
if (absSec >= 1440)
{
document.location.href = "../project/auth/logout.php";
}
This is part of the function DsplTime() metioned above. Is there any way of manipulating this function, instead of preventing it's call? absSec is out of scope, so i can't change it's value (and i think this wouldn't help anyway?
Edit 2:
So i could manage to stop the timer by
// @run-at document-start
//...
var highestTimeoutId = setTimeout(";");
for (var i = 0 ; i < highestTimeoutId ; i++) {
window.clearTimeout(i);
// window.alert(i);
}
Unfortunately, the script only works every now and then (in like 80% of the pageloading). Plus, isn't this generating a lot of load for the server? I don't want to be blocked...