Oneturn

Guides

Why online timers run late in a background tab

Last checked · Oneturn by Lumen Lab

Browsers slow down repeating timers in hidden tabs (Chrome can drop them to once a minute) and may freeze pages when a phone screen turns off. A web timer that subtracts one second at a time can then ring late or stop. Working from the end time and setting a single alarm for the moment it ends keeps it on time in a hidden tab, but no web timer can ring once the tab is closed or the device sleeps.

Chrome's rules for timers in hidden tabs

Chrome's developer documentation describes three levels for page timers (setTimeout and setInterval) when a tab is hidden (2026-10-14):

  • If the page is visible, or has played sound in the last 30 seconds, timers are barely slowed. A silent audio track does not count.
  • Otherwise timers are checked in batches once per second.
  • If the page has been hidden for more than 5 minutes, the timer has been chained five or more times, and the page has been silent for 30 seconds, timers are checked only once per minute (since Chrome 88).

A countdown that re-arms itself every second falls into that last group. Its numbers jump a minute at a time and the end sound can be close to a minute late. The documentation does not give figures for Safari or Firefox, so they are not stated here.

Phones can pause the page completely

The same documentation explains that browsers "freeze" pages to save CPU and battery, and that JavaScript timers do not run while a page is frozen. This can happen when you switch apps or the screen turns off. How soon each browser freezes a page was not checked.

Advertisement

How to keep a web timer on time

  1. Work from the end time. Recalculate "time left = end time − now" on every update, so a late redraw never shows a wrong number.
  2. Set one alarm for the end. A single, unchained timer is not subject to the once-a-minute rule and fires within about a second in a hidden tab.
  3. Save the end time. After a refresh the timer can carry on, or say how long ago it finished.
  4. Keep the phone screen on. The Screen Wake Lock API works in Chrome 84, Safari 16.4, Safari on iOS 18.4 and Firefox 126 or later (MDN compatibility data).

The Oneturn timer does the first three, and the fourth is a switch under Screen and sound settings.

What still will not work

Once you close the tab, quit the browser or the computer sleeps, a web page cannot make a sound. For a wake-up alarm you cannot miss, use your phone's clock app.

Switch to another tab and see it ring on time.

Open the timer

Guides

Advertisement