property of the
Request interface returns a string
describing the type of content being requested.
The string must be one of the
xslt strings, or the empty string, which is the default value.
destination is used by the 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
<script> elements, as well as
any of the
PaintWorklet), and the
Worker-based destinations, including
var destination = request.destination;
A string which indicates the type of content the request is asking for. This type is much broader than the usual document type values (such as
"manifest"), and may include contextual cues such as
Possible values are:
The default value of
destinationis used for destinations that do not have their own value. navigator.sendBeacon(), EventSource, <a ping>, <area ping>, fetch(), XMLHttpRequest, WebSocket, Cache and more.
The target is audio data.
The target is data being fetched for use by an audio worklet.
The target is a document (HTML or XML).
The target is embedded content.
The target is a font.
The target is an image.
The target is a manifest.
The target is an object.
The target is a paint worklet.
The target is a report.
The target is a script.
The target is a service worker.
The target is a shared worker.
The target is a style
The target is an HTML
The target is video data.
The target is a worker.
The target is an XLST transform.
In the following snippet, we create a new request using the
Request() constructor (for an image file in the same
directory as the script), then save the request's destination:
var myRequest = new Request('flowers.jpg'); var myDestination = myRequest.destination; // returns the empty string by default
|Fetch Standard (Fetch)|
BCD tables only load in the browser