Platform in Platforms
PWAs on ChromeOS (launcher and shelf)
Published Updated
On ChromeOS an installed PWA is listed in the launcher next to Android and Linux apps, can be pinned to the shelf, and opts into OS integration (a badge on its shelf icon, Web Share and Share Target, file handling, right-click shortcuts) through the same manifest members and capability APIs that Chrome uses on Windows, macOS, and Linux.
How it works
Section titled “How it works”ChromeOS runs the desktop Chrome browser, so the install path and the installed window are Chrome’s; what ChromeOS adds is where the app appears afterwards and which system surfaces (launcher, shelf, the “Open with” list, the share sheet) it can plug into.
Installing from Chrome
Section titled “Installing from Chrome”Google’s ChromeOS developer documentation asks for a manifest that supplies the name, icon,
start_url, and display mode, plus a service worker that handles fetch and can serve
start_url offline
(Powerful PWAs,
developers.google.com). With that in place, Chrome on a Chromebook offers the same two
paths as Chrome on other desktops (English UI): an Install button at the right end of
the address bar on sites that qualify, or the three-dot More menu, then Cast, save,
and share, then Install page as app…
(Chrome Help). The installed app
appears “along-side other installed apps, like in the taskbar, launcher, desktop, and app
switcher”, in Google’s words; on ChromeOS the taskbar is the shelf.
Capability support on ChromeOS
Section titled “Capability support on ChromeOS”The manifest members and APIs for ChromeOS integration have separate release schedules.
navigator.setAppBadge()on an installed app draws, in chromeos.dev’s description, “a small circle on the app’s home icon” on the shelf.navigator.share()opens the ChromeOS share sheet from any tab; ashare_targetmember registers the installed app to receive links, text, or files from other apps. chromeos.dev advises that theactionpage work offline so a share never fails for lack of a network.- A
file_handlersmember makes the installed app appear in the ChromeOS “Open with…” list for the declared MIME types and extensions; Chrome 102 and Edge 102 ship the member on desktop platforms including ChromeOS (File Handling API, developer.chrome.com). The files arrive throughwindow.launchQueue. - The
shortcutsmember fills the icon’s right-click menu in the launcher and on the shelf. - From Chrome 96 the manifest
idmember identifies the app independently ofstart_url, and two PWAs from one origin can coexist when their manifests carry differentidvalues (chromeos.dev, 2022-05-23).
The Google page is explicit that a capability stable in Chrome on Windows or macOS “can sometimes be a multi-year process” to reach stable support on ChromeOS, so a ChromeOS claim needs a ChromeOS check.
Examples
Section titled “Examples”Badging and file handling shipped separately and are detected separately; neither check implies the other.
Badging the shelf icon only where badges exist
Section titled “Badging the shelf icon only where badges exist”Detect setAppBadge before setting a badge in an installed ChromeOS app. Firefox has no
implementation, and browser-compat-data records no support in Chrome for Android (badging-api dataset, BCD api.Navigator.setAppBadge).
async function setLauncherBadge(count) { if (!('setAppBadge' in navigator)) { return false; // no badge surface here: show the count inside the app instead } if (count > 0) { await navigator.setAppBadge(count); } else { await navigator.clearAppBadge(); } return true;}The function returns false when it did nothing, so the caller can render an in-app
counter on browsers without the API instead of silently dropping the signal.
Receiving files from “Open with…”
Section titled “Receiving files from “Open with…””The file_handlers member only takes effect once the app is installed, and launchQueue
exists only in browsers that implement the API, so the consumer is registered behind a
check and the ordinary file picker remains the fallback:
if ('launchQueue' in window && 'files' in LaunchParams.prototype) { window.launchQueue.setConsumer(async (launchParams) => { if (!launchParams.files.length) return; for (const handle of launchParams.files) { const file = await handle.getFile(); openDocument(file); } });} else { document.querySelector('#open-file').hidden = false; // <input type="file"> path}The 'files' in LaunchParams.prototype test is the one developer.chrome.com documents; a
bare 'launchQueue' in window also matches browsers that use the queue for other launch
types.
Observed behaviour
Section titled “Observed behaviour”Uninstalling a PWA on a Chromebook is a launcher operation, and its data checkbox is worded differently from the one Chrome shows on Windows and macOS.
Because ChromeOS storage is the browser profile’s storage, that checkbox removes the service worker registration and Cache Storage for the origin as well, so the site loads as a first visit afterwards.
See also
Section titled “See also”- Powerful PWAs (developers.google.com)
- Features to take full advantage of PWA installation (chromeos.dev)
- File Handling API (developer.chrome.com)
- Manifest file_handlers
- Manifest shortcuts
- Badging API: app icon badges for installed PWAs
- PWAs on Chrome and Android (WebAPK, TWA)
- PWAs on desktop
Specifications
| Specification | Status |
|---|---|
| None. | |