Javascript Question

Browser rounds to 1 sec any timeout < 1sec

Start function then switch to another window->any timeouts which have < 1 sec rounds to 1 sec

Maybe you will give me some magic?


Solved problem , thx to NineBerry


Mozilla documentation says:

To reduce the load (and associated battery usage) from background tabs, timeouts are often clamped to firing no more often than once per second (1000 ms) in inactive tabs.

Firefox implements this behavior since version 5 (see bug 633421, the 1000ms constant can be tweaked through the dom.min_background_timeout_value preference). Chrome implements this behavior since version 11 (

Firefox for Android uses a timeout value of 15 minutes for background tabs since bug 736602 in Firefox 14, and background tabs can also be unloaded entirely.

It then goes on to say that this is only disabled for tabs with audio playback active. Generally, the time you specify when calling setTimeout, is not guaranteed to be respected by the browser 100%.

Why would having the callback function being called with a slower frequency be a problem for your application?