coderef

Service workers static routingLimited availability

The service worker install event's addRoutes method declares resource paths that should either be fetched from the network or the cache, to bypass the service worker and improve performance.

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
1–122Not supported
123+Supportedsince Mar 19, 2024
Current: 155
Edge
12–122Not supported
123+Supportedsince Mar 22, 2024
Current: 154
Firefox
✕Not supportedup to 157
Current: 157
Safari
1–26.6Not supported
27+Supportedsince Sep 14, 2026
Current: 27
MobileChrome Android
18–122Not supported
123+Supportedsince Mar 19, 2024
Current: 155
Firefox Android
✕Not supportedup to 157
Current: 157
Safari iOS
1–26.6Not supported
27+Supportedsince Sep 14, 2026
Current: 27

How to use

Not supported in Firefox, Firefox Android. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: InstallEvent.

Feature detection

JS · check before using
if ("InstallEvent" in globalThis && "addRoutes" in InstallEvent.prototype) {
  // InstallEvent.addRoutes is available
}

Sub-features

Support for each part of the feature (3). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
InstallEvent4017✕2740✕27
InstallEvent.InstallEvent4079✕2740✕27
InstallEvent.addRoutes123123✕27123✕27