Navigation Preload Prioritization in Chrome
0 reputation · 21 Jul 2023, 23:16 UTC
Goal
Determine how Chrome’s Service Worker navigation preload feature resolves conflicts when both a preloaded response and a Service Worker‑generated response are available for the same navigation request.
Constraints
Chrome implements navigation preload starting in version 63. The feature is disabled by default and must be enabled via self.registration.navigationPreload.enable() in the Service Worker’s activate event. When enabled, Chrome initiates a network fetch while the Service Worker boots and still dispatches a fetch event to the worker. The worker can return a custom response or let the preloaded response pass through.
Unresolved Questions
- When both the preloaded response and a Service Worker response are present, which one does Chrome use to satisfy the navigation?
- Does the presence of caching headers such as
Cache-ControlorETaginfluence the choice between the two responses? - How does Chrome handle conditional requests (e.g.,
If-None-Match) when a preloaded response returns304 Not Modifiedbut the Service Worker returns a fresh body?