diff --git a/files/en-us/web/api/request/destination/index.md b/files/en-us/web/api/request/destination/index.md index 5f435863f3397f8..ca92195a35f8881 100644 --- a/files/en-us/web/api/request/destination/index.md +++ b/files/en-us/web/api/request/destination/index.md @@ -8,29 +8,14 @@ browser-compat: api.Request.destination {{APIRef("Fetch API")}}{{AvailableInWorkers}} -The **`destination`** read-only -property of the **{{domxref("Request")}}** interface returns a string -describing the type of content being requested. - -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` -or `xslt` strings, or the empty string, which is the default value. - -The `destination` is used by the {{Glossary("user agent")}} to, for example, -help determine which set of rules to follow for CORS purposes, or how to navigate any -complicated code paths that affect how specific types of request get handled. - -These destinations vary substantially in how they operate. Some are data receptacles, -where the received data is stored for processing later. Others are script-based, in -which case the received data is delivered to a script by calling it and passing the data -along. Script-based destinations include {{HTMLElement("script")}} elements, as well as -any of the {{domxref("Worklet")}}-based destinations -(including subclasses like {{domxref("AudioWorklet")}}), and the -{{domxref("Worker")}}-based destinations, including {{domxref("ServiceWorker")}} -and {{domxref("SharedWorker")}}. +The **`destination`** read-only property of the **{{domxref("Request")}}** interface returns a string describing the type of content being requested. + +The string must be one of the `audio`, `audioworklet`, `document`, `embed`, `fencedframe`, `font`, `frame`, `iframe`, `image`, `json`, `manifest`, `object`, `paintworklet`, `report`, `script`, `sharedworker`, `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, help determine which set of rules to follow for CORS purposes, or how to navigate any complicated code paths that affect how specific types of request get handled. + +These destinations vary substantially in how they operate. Some are data receptacles, where the received data is stored for processing later. Others are script-based, in which case the received data is delivered to a script by calling it and passing the data along. +Script-based destinations include {{HTMLElement("script")}} elements, as well as any of the {{domxref("Worklet")}}-based destinations (including subclasses like {{domxref("AudioWorklet")}}), and the {{domxref("Worker")}}-based destinations, including {{domxref("ServiceWorker")}} and {{domxref("SharedWorker")}}. ## Value @@ -79,6 +64,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"` @@ -92,9 +79,7 @@ Possible values are: ## Examples -In the following snippet, we create a new request using the -{{domxref("Request.Request", "Request()")}} constructor (for an image file in the same -directory as the script), then save the request's destination: +In the following snippet, we create a new request using the {{domxref("Request.Request", "Request()")}} constructor (for an image file in the same directory as the script), then save the request's destination: ```js const myRequest = new Request("flowers.jpg"); diff --git a/files/en-us/web/http/reference/headers/speculation-rules/index.md b/files/en-us/web/http/reference/headers/speculation-rules/index.md index 1ca673436b5f0df..2910e0a9e9b6563 100644 --- a/files/en-us/web/http/reference/headers/speculation-rules/index.md +++ b/files/en-us/web/http/reference/headers/speculation-rules/index.md @@ -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 will be requested with a [`destination`](/en-US/docs/Web/API/Request/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 [`