Sec-Purpose header

Limited availability

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

The HTTP Sec-Purpose fetch metadata request header indicates the purpose for which the requested resource will be used, when that purpose is something other than immediate use by the user-agent.

The only purpose that is currently defined is prefetch, which indicates that the resource is being requested in anticipation that it will be needed by a page that is likely to be navigated to in the near future, such as a page linked in search results or a link that a user has hovered over. The server can use this knowledge to: adjust the caching expiry for the request, disallow the request, or perhaps to treat it differently when counting page visits.

The header is sent when a page is loaded that has a <link> element with attribute rel="prefetch". Note that if this header is set then a Sec-Fetch-Dest header in the request must be set to empty (any value in the <link> attribute as is ignored) and the Accept header should match the value used for normal navigation requests.

Header type Fetch Metadata Request Header
Forbidden request header Yes (Sec- prefix)
CORS-safelisted request header No

Syntax

http
Sec-Purpose: prefetch

Directives

The allowed tokens are:

prefetch

The purpose is to prefetch a resource that may be needed in a probable future navigation.

Examples

A prefetch request

Consider the case where a browser loads a file with a <link> element that has the attribute rel="prefetch" and an href attribute containing the address of an image file. The resulting fetch() should result in an HTTP request where Sec-Purpose: prefetch, Sec-Fetch-Dest: empty, and an Accept value that is the same as the browser uses for page navigation.

An example of such a header (on Firefox) is given below:

http
GET /images/some_image.png HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/116.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Sec-Purpose: prefetch
Connection: keep-alive
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: no-cors
Sec-Fetch-Site: same-origin
Pragma: no-cache
Cache-Control: no-cache

Note: At time of writing Firefox incorrectly sets the Accept header as Accept: */* for prefetches. The example has been modified to show what the Accept value should be. This issue can be tracked in Firefox bug 1836334.

Specifications

Specification
Fetch
# sec-purpose-header
Prefetch
# sec-purpose-header

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
Sec-Purpose
Chrome – Full support
Chrome 110 (Release date: 2023-02-07)
footnote Full support
Edge – Full support
Edge 110 (Release date: 2023-02-09)
footnote Full support
Firefox – Full support
Firefox 115 (Release date: 2023-07-04)
footnote Full support
Opera – Full support
Opera 96 (Release date: 2023-02-22)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 110 (Release date: 2023-02-07)
footnote Full support
Firefox for Android – Full support
Firefox for Android 115 (Release date: 2023-07-04)
footnote Full support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – Full support
Samsung Internet 21 (Release date: 2023-05-19)
footnote Full support
WebView Android – Full support
WebView Android 110 (Release date: 2023-02-07)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote No support
Sec-Purpose for <link rel="prefetch"> prefetch
Chrome – No support
Chrome
footnote
footnote Doesn't support Sec-Purpose for <link rel="prefetch">. In Chrome, the legacy Purpose: prefetch header is used to indicate a link request is a prefetch. See bug 40236973.
Edge – No support
Edge
footnote
footnote Doesn't support Sec-Purpose for <link rel="prefetch">. In Edge, the legacy Purpose: prefetch header is used to indicate a link request is a prefetch. See bug 40236973.
Firefox – Full support
Firefox 115 (Release date: 2023-07-04)
footnote
footnote Sec-Purpose: prefetch replaces the non-standard X-moz: prefetch header that was used to indicate a link prefetch request in earlier versions.
footnote Prefetch requests should also include the header Accept header string for navigations, but Accept: */* is sent instead.
Opera – No support
Opera
footnote
footnote Doesn't support Sec-Purpose for <link rel="prefetch">. In Opera, the legacy Purpose: prefetch header is used to indicate a link request is a prefetch. See bug 40236973.
Safari – No support
Safari
footnote No support
Chrome Android – No support
Chrome Android
footnote
footnote Doesn't support Sec-Purpose for <link rel="prefetch">. In Chrome Android, the legacy Purpose: prefetch header is used to indicate a link request is a prefetch. See bug 40236973.
Firefox for Android – Full support
Firefox for Android 115 (Release date: 2023-07-04)
footnote
footnote Sec-Purpose: prefetch replaces the non-standard X-moz: prefetch header that was used to indicate a link prefetch request in earlier versions.
footnote Prefetch requests should also include the header Accept header string for navigations, but Accept: */* is sent instead.
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote
footnote Doesn't support Sec-Purpose for <link rel="prefetch">. In Samsung Internet, the legacy Purpose: prefetch header is used to indicate a link request is a prefetch. See bug 40236973.
WebView Android – No support
WebView Android
footnote
footnote Doesn't support Sec-Purpose for <link rel="prefetch">. In WebView Android, the legacy Purpose: prefetch header is used to indicate a link request is a prefetch. See bug 40236973.
WebView on iOS – No support
WebView on iOS
footnote No support
Sec-Purpose for <script type="speculationrules"> prefetch
Experimental
Chrome – Full support
Chrome 110 (Release date: 2023-02-07)
footnote Full support
Edge – Full support
Edge 110 (Release date: 2023-02-09)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 96 (Release date: 2023-02-22)
footnote Full support
Safari – No support
Safari 26.2 (Release date: 2025-12-12)
disabled
disabled From version 26.2 users must explicitly set the SpeculationRules prefetch preference.
Chrome Android – Full support
Chrome Android 110 (Release date: 2023-02-07)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS 26.2 (Release date: 2025-12-12)
disabled
disabled From version 26.2 users must explicitly set the SpeculationRules prefetch preference.
Samsung Internet – Full support
Samsung Internet 21 (Release date: 2023-05-19)
footnote Full support
WebView Android – Full support
WebView Android 110 (Release date: 2023-02-07)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote No support

Legend

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

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.
User must explicitly enable this feature.

See also