This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

XDomainRequest is an implementation of HTTP access control (CORS) that worked in Internet Explorer 8 and 9. It was removed in Internet Explorer 10 in favor of using XMLHttpRequest with proper CORS; if you are targeting Internet Explorer 10 or later, or wish to support any other browser, you need to use standard HTTP access control.

This interface can send both GET and POST requests.


var xdr = new XDomainRequest();

Returns a new XDomainRequest object, which can then be used to make and manage these requests.


Gets or sets the amount of time until a request times out.
Gets the response body as a string.


Opens the request, specifing the method (GET/POST) and URL.
Sends the request. POST data is specified in this method.
Aborts the request.

Event handlers

A handler for when the request has made progress between the send method call and the onload event.
A handler for when the request times out.
A handler for when a request has errored.
A handler for when the full response has been received from the server.


  var xdr = new XDomainRequest();

  xdr.open("get", "http://example.com/api/method");

  xdr.onprogress = function () {

  xdr.ontimeout = function () { 

  xdr.onerror = function () { 
    //Error Occurred

  xdr.onload = function() {

  setTimeout(function () {
  }, 0);

Note: The xdr.send() call is wrapped in a timeout (see window.setTimeout() to prevent an issue with the interface where some requests are lost if multiple XDomainRequests are being sent at the same time.


The XDomainRequest is built to be secure in multiple ways.

  • The origin's security protocol must match that of the requested URL. (http to http, https to https). If these do not match, the request will error "Access is Denied".
  • The requested URL's server must have the Access-Control-Allow-Origin header set to either all ("*") or to include the origin of the request.


This interface and its methods are non-standard.

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
XDomainRequest No support No support 8.0, 9.0 No support No support
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
XDomainRequest No support No support ? No support No support

Document Tags and Contributors

Contributors to this page: tan9, antonmaximus, Sebastianz, teoli, Sheppy, Milakai, AndrewMcGivery
Last updated by: tan9,