Home

responseType

ResponseType is a property of the XMLHttpRequest interface used in web browsers to control how a response is delivered to client code. It determines the data type into which the server’s response is converted, allowing efficient handling of text, binary data, or documents.

Common values include:

- "" (empty string): the default, the response is provided as text via responseText.

- "text": the response is returned as text, similar to the default.

- "arraybuffer": the response is an ArrayBuffer suitable for binary data processing.

- "blob": the response is a Blob object.

- "document": the response is parsed as an HTML or XML Document.

- "json": the response is parsed as JSON and exposed as an object via response.

Some browsers have non-standard values such as "moz-chunked-arraybuffer" for streaming binary data and "ms-stream" for IE/Edge;

Usage notes: Set xhr.responseType before calling xhr.send(). When the request completes, xhr.response contains the data in

Comparison: Fetch API provides similar capabilities but without a responseType property; instead, you invoke response.text(), response.json(),

these
are
not
universally
supported.
the
requested
form.
If
the
browser
does
not
support
a
type,
the
value
becomes
an
empty
string
or
preserves
the
default
behavior,
depending
on
implementation.
response.blob(),
or
response.arrayBuffer()
to
process
the
data.
This
reflects
a
shift
toward
promise-based
handling
and
explicit
parsing
choices
rather
than
a
single
response
type
property.