Below is my code which redirects the user to the main page after 10sec of inactivity:
function endAndStartTimer() {
window.clearTimeout(timer);
var timer;
//var millisecBeforeRedirect = 10000;
timer = window.setTimeout(function(){alert('Hello!');},10000);
}
The code works fine. But the timer doesn’t reset after being inactive. Can anyone tell me how to do cleartimeout?