Service-Worker-Navigation-Preload

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 header name 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
# handle-fetch

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
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

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