demo · v132

Which APIs stop when the tab is frozen?

"Frozen" doesn't mean "killed". The tab is paused, and selected work resumes on visibility. But every async API has subtly different semantics. Here is the table.

API / sourcebehaviour when frozen
setTimeout / setInterval (user code)frozen — timers paused; resume on unfreeze
requestAnimationFramefrozen — no callbacks delivered while hidden anyway
requestIdleCallbackfrozen
postMessage to this tab from anotherqueued — delivered on unfreeze
BroadcastChannel messagesqueued
fetch (in-flight)aborted — will reject on unfreeze
WebSocket message arrivalsocket stays open at TCP level; events queued
WebRTC media tracksruns — calls are silent-but-active exempted
service worker fetch handlerruns — SW has its own freeze policy
shared worker / dedicated workerfrozen alongside the tab
IndexedDB transaction in progresspaused; resumes on unfreeze
Notification.show()queued; fires on unfreeze
Web Audio playbackif audio is playing, freeze is silently inhibited
BackgroundFetchruns — background-fetch is the explicit way to do work while frozen
WebTransport datagramsfrozen
visibilitychange eventfires on unfreeze (hidden → visible transition)

opt-out: the freeze-listener event

A page can listen for the freeze and resume events on document and reduce footprint before being frozen. Doesn't prevent freezing — just lets you save state.

app-level strategies for staying useful

1. Use BackgroundFetch for large downloads

BackgroundFetch survives freeze and even tab close. Switch any >1 MB downloads over to it.

2. Use Push for inbound notifications

The push service path is exempt; rely on it instead of in-tab WebSocket polling for user-visible notifications.

3. Persist state on freeze event

Listen for document.freeze and write any unsaved state to IndexedDB / OPFS before the freeze lands.

4. Don't poll — subscribe

Replace polling timers with event-driven listeners. Polling is exactly the workload Chrome wants to stop.

see also

scenario focus

Select a scenario to focus its rendered example and summary.