v160 · capabilities (fugu) · launch handling
WebAppLaunch: user activation on focus-existing launch delivery
An installed web app with "launch_handler": {"client_mode": "focus-existing"} receives every relaunch in its existing window through launchQueue.setConsumer(). Until now that consumer ran without user activation — even though the user had just clicked a shortcut, link, file or share — so it could not call window.open() or requestFullscreen(). Chrome 160 grants the existing document transient activation as the launch is delivered, exactly once per launch, the same way clicking a page’s own Notification activates that page.
navigator.userActivation.isActive inside the consumer. It ships enabled by default with no enable flag; the kill switch --disable-features=WebAppLaunchHandlerUserActivation brings back the old behaviour for comparison. In a normal browser tab no launch is ever delivered, so the pages show only clearly labelled tab-side baselines there.
concepts
-
Consumer activation probe
The canonical check:
navigator.userActivation.isActiveread as the first line of the real consumer, logged per delivery withhasBeenActive, a +1-task re-read (as Chromium’s browser test does) and a +6 s re-read after expiry — plus the tab-side with/without-gesture baseline. -
Gated API matrix
Choose which activation-gated calls the consumer attempts —
window.open(),requestFullscreen(),showOpenFilePicker(),navigator.share()— and in what order. The results show the budget: one launch is one activation, and consuming calls spend it. -
Workspace router
The motivating use case: a document app that uses
focus-existingto avoid duplicate windows, yet opens a different notebook in its own window viawindow.open()— with the in-app prompt fallback older builds required and a loop guard for link capturing. -
When activation is withheld
Edge and migration: real reload/re-delivery evidence across documents, plus a labelled path explorer showing why
navigate-new,navigate-existing, no open window, an out-of-scope window, a non-user launch, the kill switch and re-delivery all get no grant. -
Launch to present
Composition with File Handling and Fullscreen: open a
.slidesfile or the Present from slide 3 shortcut and the already-open presenter loads the deck and goes fullscreen straight from the consumer — or offers a Present button when no activation arrived.
why it shipped
focus-existing exists so single-window apps (music players, editors with their own tab strips) never spawn duplicate windows. But every launch is a user action outside the app, and the consumer that receives it could do nothing a user gesture normally allows: no new window for a document that belongs elsewhere, no fullscreen, no picker. Developers reported it in manifest-incubations #141. The spec now runs the activation notification steps for the focused document — mirroring how a click on a page-created Notification activates that page — and limits it to one activation per user-initiated launch, never on navigating launches or re-delivery. Existing apps benefit without code changes.
the API
// manifest
"launch_handler": { "client_mode": "focus-existing" }
// page
launchQueue.setConsumer((params) => {
if (navigator.userActivation.isActive) { // Chrome 160+, focus-existing delivery
window.open(params.targetURL); // now allowed
} else {
showInAppPrompt(params.targetURL); // older builds / non-user launch / kill switch
}
});
references
- ChromeStatus entry
- Spec — Web App Launch Handler API: prepare an application context
- Explainer — launch_handler
- Developer report — manifest-incubations #141
- Chromium CL 8769986 — grant transient user activation on focus-existing launch delivery
- crbug.com/583976233 — tracking bug
- Chrome docs — Launch Handler API
- MDN — UserActivation
- MDN — Launch Handler API