Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion files/en-us/web/api/request/destination/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The string must be one of the `audio`, `audioworklet`,
`document`, `embed`, `fencedframe`, `font`, `frame`,
`iframe`, `image`, `json`, `manifest`, `object`,
`paintworklet`, `report`, `script`, `sharedworker`,
`style`, `track`, `video`, `worker`
`speculationrules`, `style`, `track`, `video`, `worker`
or `xslt` strings, or the empty string, which is the default value.

The `destination` is used by the {{Glossary("user agent")}} to, for example,
Expand Down Expand Up @@ -79,6 +79,8 @@ Possible values are:
- : The target is a service worker.
- `"sharedworker"`
- : The target is a shared worker.
- `"speculationrules"`
- : The target is a [speculation rules](/en-US/docs/Web/API/Speculation_Rules_API) JSON document.
- `"style"`
- : The target is a style
- `"track"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ sidebar: http

The HTTP **`Speculation-Rules`** {{Glossary("response header")}} provides one or more URLs pointing to text resources containing speculation rule JSON definitions. When the response is an HTML document, these rules will be added to the document's speculation rule set. See the [Speculation Rules API](/en-US/docs/Web/API/Speculation_Rules_API) for more information.

The resource file containing the speculation rules JSON can have any valid name and extension, but it must be served with an `application/speculationrules+json` MIME type.
The resource file containing the speculation rules JSON can have any valid name and extension, but it with be requested with a destination type of [`speculationrules`](/en-US/docs/Web/API/Request/destination#speculationrules), and must be served with an `application/speculationrules+json` MIME type.

> [!NOTE]
> This mechanism provides an alternative to specifying the JSON definition inside an inline [`<script type="speculationrules">`](/en-US/docs/Web/HTML/Reference/Elements/script/type/speculationrules) element. Specifying an HTTP header is useful in cases where developers are not able to directly modify the document itself.
Expand Down