I have a timer that counts down every second. It works fine until the user opens 3 or 4 tabs of my site, after which the newest tab timer will have double or triple speed. Currently, I can only reproduce the error in IE8. I previously used setInterval and could also reproduce the error in Firefox.
I actually use FBJS (Facebook Javascript), so I will just give the pseudo code.
function countDown() { ... setTimeout(function() { countDown() }, 1000); } countDown();
However, what I'm really looking for is more theoretical. I know that browsers can try to catch up with setInterval, but how can this affect multiple tabs for setTimeout?
javascript timer settimeout setinterval fbjs
lamplighter
source share