← Back to release summary

ServiceWorker support for Speculation Rules Prefetch

Category
Service Worker
Type
No developer-visible change
Status
Proposed (Chrome Proposed)
Intent stage
None

Summary

This feature enables ServiceWorker-controlled prefetches, that is a speculation rules prefetch to URLs controlled by a Service Worker. Previously, the prefetch is cancelled upon detecting a controlling Service Worker, thus subsequent navigation to the prfetch target is served by the non-prefetch path. This feature will enable the prefetch request to go through the Service Worker's fetch handler and the response with the Service Worker interception is cached in the prefetch cache, resulting in a subsequent navigation being served by the prefetch cache. Please use the enterprise policy PrefetchWithServiceWorkerEnabled to control this feature.

Motivation

Speculation rules prefetch is a popular feature, with ~11% of page loads initiating such a prefetch. Service workers are an even more popular feature, with ~25% of page loads controlled by a service worker. Previously, attempting to prefetch a service worker controlled page would not work: the prefetch would not even be attempted. We're fixing this! This will automatically speed up many sites which are already using both features together, and unblock some sites which were previously unable to deploy prefetch because it conflicted with their existing service workers. Another benefit of this work is that it aligns speculation rules prefetch with speculation rules prerender. Speculation rules prerender already works with service workers; by ensuring speculation rules prefetch does as well, we make the transition path between these technologies more smooth for web developers. This work is part of a long-term effort to remove as many reasons as possible that Chromium currently fails to prefetch or prerender a target page. We usually consider these changes as bug fixes, and from one perspective, this work is also just a bug fix. But because it changes more code and will have a bigger impact than other such fixes, we're documenting it in more detail here.

Standards & signals

Docs: https://docs.google.com/document/d/192ZLkKcaUE_9Qt8bW9OZLViEEbtxOAgq5WYR87m79IE/edit?usp=sharing

View on chromestatus.com