Skip to content

Performance · Concept

Lighthouse PWA audits

Published

In one line: Per Chrome for Developers, Lighthouse is an open-source, automated tool that runs a series of audits against a URL and reports how well the page performed, with audits for performance, accessibility, SEO, and more. Its PWA category is no longer part of that report: per the Chrome blog post on revisiting the installability criteria, the Lighthouse PWA checks were directly associated with those criteria, so Chrome decided to remove the category from Lighthouse.

Per Chrome for Developers, you can run Lighthouse in Chrome DevTools, from the command line, as a Node module, or from a web UI — and the CLI and Node workflows require an instance of Google Chrome installed on your machine. In DevTools, Lighthouse has its own panel: open the page you want to audit, open the Lighthouse tab, and run the audit.

Per Chrome for Developers, the Node module is installed globally with the -g flag and then pointed at a URL, and lighthouse --help lists all the options:

Terminal window
npm install -g lighthouse
lighthouse https://example.com
lighthouse --help

Per Chrome for Developers, you can also use Lighthouse CI to prevent regressions on your sites.

With the PWA category gone, the runtime signal that a browser considers the page installable is the beforeinstallprompt event. Per MDN, it fires when the browser has detected that a website can be installed as a Progressive Web App, and the typical use is to reveal your own in-app installation UI — which, per MDN, should be hidden by default, because not all browsers support installation. Per MDN, the handler keeps a reference to the BeforeInstallPromptEvent and calls its prompt() method when the user acts on that UI:

const installButton = document.querySelector('#install');
if ('onbeforeinstallprompt' in window) {
window.addEventListener('beforeinstallprompt', (event) => {
installButton.hidden = false;
installButton.addEventListener('click', () => event.prompt(), { once: true });
});
} else {
// No support for the event: leave the in-app install UI hidden and let the
// browser offer whatever install affordance it has of its own accord.
installButton.hidden = true;
}
  • Do not build a workflow on the PWA audits. Per the Lighthouse audit reference, PWA testing in Lighthouse is deprecated, and per the Chrome blog post the category was removed — a score you remember from an older report is not something the current tool still produces.
  • Use DevTools for installability instead. Per the Chrome blog post, the checks for optimizations and debugging for installable experiences are still available in DevTools.
  • The old service-worker requirement moved. Per the Chrome blog post, Chrome removed the requirement to have a service worker implementing fetch() in order to install from the menu, since version 108 on mobile and 112 on desktop; the blog post states that the algorithm displaying the install prompt still required the presence of a fetch() handler at the time of writing. A cached mental model of “no fetch handler, no install” is no longer accurate for the menu path.
  • Service workers still matter. Per the Chrome blog post, they remain a core web technology, necessary for experiences such as a good cache strategy, notifications and custom offline experiences — the criteria change is not a reason to drop yours.
  • beforeinstallprompt is not a portable test. Per MDN, it has limited availability and is not Baseline, so treat its absence as “this browser does not offer this hook”, not as “this page is not installable”.
  • The CLI needs a browser. Per Chrome for Developers, the CLI and Node workflows require you to have an instance of Google Chrome installed on your machine.

Specifications

SpecificationStatus
None.