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 / source | behaviour when frozen |
|---|---|
| setTimeout / setInterval (user code) | frozen — timers paused; resume on unfreeze |
| requestAnimationFrame | frozen — no callbacks delivered while hidden anyway |
| requestIdleCallback | frozen |
| postMessage to this tab from another | queued — delivered on unfreeze |
| BroadcastChannel messages | queued |
| fetch (in-flight) | aborted — will reject on unfreeze |
| WebSocket message arrival | socket stays open at TCP level; events queued |
| WebRTC media tracks | runs — calls are silent-but-active exempted |
| service worker fetch handler | runs — SW has its own freeze policy |
| shared worker / dedicated worker | frozen alongside the tab |
| IndexedDB transaction in progress | paused; resumes on unfreeze |
| Notification.show() | queued; fires on unfreeze |
| Web Audio playback | if audio is playing, freeze is silently inhibited |
| BackgroundFetch | runs — background-fetch is the explicit way to do work while frozen |
| WebTransport datagrams | frozen |
| visibilitychange event | fires 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.