How can I clear timeout
that has been set in another tab
in browser?
I tried by storing timeout reference in localStorage
, but could not clear timeout
function setIdleTimeout() {
var idleTimeout = setTimeout(function() {
//autologout
}, 20000);
localStorage.setItem('idleTimeout', idleTimeout);
}
function clearIdleTimeout() {
var idleTimeout = localStorage.getItem('idleTimeout');
clearTimeout(idleTimeout);
localStorage.setItem('idleTimeout', idleTimeout);
}
If I call clearIdleTimeout()
in second tab, it does not clear the timeout
set in previous tab