XMLHttpRequest: XMLHttpRequest() constructor
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Note: This feature is available inWeb Workers, except forService Workers.
TheXMLHttpRequest() constructorcreates a newXMLHttpRequest.
In this article
Syntax
new XMLHttpRequest()// Non-standardnew XMLHttpRequest(options)Parameters
There are no standard parameters. However, Firefox allows a non-standard parameter:
optionsNon-standardAn object that can contain the following flags:
mozAnonA boolean. When setting this flag to
truewill cause the browser not to expose theorigin and user credentials when fetching resources. Most important, this means thatcookies will not be sent unless explicitly added usingsetRequestHeader.mozSystemA boolean. When setting this flag to
true, the same origin policy will not be enforced on the request.
Return value
A newXMLHttpRequest object. The object must be prepared by at leastcallingopen() to initialize it before callingsend() to send the request to the server.
Specifications
| Specification |
|---|
| XMLHttpRequest> # dom-xmlhttprequest> |