A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

[Proposal] Lifecycle for the Web - for system initiated resource re-allocation


We would like to propose A Lifecycle For Web Apps to support system initiated termination and CPU suspension.

With large numbers of web apps (and tabs) running, critical resources such as memory, CPU, battery, network etc easily get oversubscribed, leading to a bad end user experience. Application lifecycle is a key way that modern OS’ manage resources. On Android, iOS and also more recent Windows versions, apps can be started and stopped at will by the platform. This lets the platform streamline and re-allocate resources where they best benefit the user.

To fill this gap in the web platform, it is important to create the right incentive structure for web developers, and allow the system to proactively reallocate resources and avoid getting into extreme resource situations. For a platform to support application lifecycle, it needs to:

  • provide developers with signals about transitions between the lifecycle states
  • provide lifecycle-compatible APIs that allow key capabilities to work even when the app is backgrounded or stopped.

This proposal defines what the lifecycle of a web page is and adds necessary extensions to enable supporting two important system interventions necessary for resource re-allocation:

  1. Tab discarding for memory saving
  2. CPU stopping for battery saving

Please take a look at the explainer above for problem statement, proposal, usage and more details. Feedback welcome!

\cc @surma @igrigorik @ojanvafai @toddreifsteck @Jake_Archibald @RickByers @tabatkins


Mobile browsers already unload pages, leaving their tabs behind. It was something we had to side-step in the service worker spec, since we didn’t really know how to represent pages that existed in terms of UI (tabs), but weren’t in memory when it came to the clients API.

So yeah, standardising unloading/stopping would be great!


This is quite interesting - and thanks for providing the use cases and details. I’ll try to get a few more Mozilla folks to look at this proposal.


Thanks that would be great! Looking forward to feedback from Mozilla folks.


I, as a Microsoft rep, am interested in seeing this proposal and supporting documents moved to a WICG GitHub repo to allow for easy conversations and issue tracking.


Moved to WICG-space: https://github.com/WICG/web-lifecycle.