Service-Worker-Navigation-Preload header

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The HTTP Service-Worker-Navigation-Preload request header indicates that the request was the result of a fetch() operation made during service worker navigation preloading. It allows a server to respond with a different resource than for a normal fetch().

If a different response may result from setting this header, the server must include a Vary: Service-Worker-Navigation-Preload header in responses to ensure that different responses are cached.

For more information see NavigationPreloadManager.setHeaderValue() (and NavigationPreloadManager).

Header type Request header
Forbidden request header No

Syntax

http
Service-Worker-Navigation-Preload: <value>

Directives

<value>

An arbitrary value that indicates what data should be sent in the response to the preload request. This defaults to true. It maybe set to any other string value in the service worker, using NavigationPreloadManager.setHeaderValue().

Examples

Service worker navigation preloading headers

The following request header is sent by default in navigation preload requests:

http
Service-Worker-Navigation-Preload: true

The service worker can set a different header value using NavigationPreloadManager.setHeaderValue(). For example, in order to request that a fragment of the requested resource be returned in JSON format, the value could be set with the string json_fragment1.

http
Service-Worker-Navigation-Preload: json_fragment1

Specifications

Specification
Service Workers Nightly
# handle-fetch

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Service-Worker-Navigation-Preload request header
Chrome – Full support
Chrome 59 (Release date: 2017-06-05)
footnote Full support
Edge – Full support
Edge 18 (Release date: 2018-10-02)
footnote Full support
Firefox – No support
Firefox 97 (Release date: 2022-02-08)
disabled
disabled From version 97 users must explicitly set the dom.serviceWorkers.navigationPreload.enabled preference to true. To change preferences in Firefox, visit about:config.
Firefox – Preview support
Firefox Nightly
footnote Preview browser support
Opera – Full support
Opera 46 (Release date: 2017-06-22)
footnote Full support
Safari – Full support
Safari 15.4 (Release date: 2022-03-14)
footnote Full support
Chrome Android – Full support
Chrome Android 59 (Release date: 2017-06-06)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 43 (Release date: 2017-09-27)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15.4 (Release date: 2022-03-14)
footnote Full support
Samsung Internet – Full support
Samsung Internet 7 (Release date: 2018-03-16)
footnote Full support
WebView Android – Full support
WebView Android 59 (Release date: 2017-06-06)
footnote Full support
WebView on iOS – Full support
WebView on iOS 15.4 (Release date: 2022-03-14)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
In development. Supported in a pre-release version.
In development. Supported in a pre-release version.
No support
No support
User must explicitly enable this feature.
Has more compatibility info.

See also