Get to know MDN better
This feature is not Baseline because it does not work in some of the most widely-used browsers.
The parameter passed into an install event handler function, the InstallEvent interface represents an install action that is dispatched on the ServiceWorkerGlobalScope of a ServiceWorker. As a child of ExtendableEvent, it ensures that functional events such as FetchEvent are not dispatched during installation.
This interface inherits from the ExtendableEvent interface.
Event ExtendableEvent InstallEventCreates a new InstallEvent object.
Inherits properties from its parent, ExtendableEvent.
Inherits methods from its parent, ExtendableEvent.
addRoutes()Specifies one or more static routes, which define rules for fetching specified resources that will be used even before service worker startup.
This code snippet is from the service worker prefetch sample (see prefetch running live.) The code calls ExtendableEvent.waitUntil() in ServiceWorkerGlobalScope.oninstall and delays treating the ServiceWorkerRegistration.installing worker as installed until the passed promise resolves successfully. The promise resolves when all resources have been fetched and cached, or when any exception occurs.
The code snippet also shows a best practice for versioning caches used by the service worker. Although this example has only one cache, you can use this approach for multiple caches. The code maps a shorthand identifier for a cache to a specific, versioned cache name.
Note: Logging statements are visible in Google Chrome via the "Inspect" interface for the relevant service worker accessed via chrome://serviceworker-internals.
| Service Workers Nightly # installevent |
Enable JavaScript to view this browser compatibility table.
This page was last modified on May 23, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.