Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


xmlhttprequest level 2 support #385

aeosynth opened this Issue · 10 comments

3 participants


var progEv = !!(window.ProgressEvent);
var fdata = !!(window.FormData);
setResult('xhr20', (progEv && fdata));

i've seen other XHR2 tests that just look for 'WithCredentials in window.XMLHTTPRequest`

can you look into which is best?
also can you link up the spec pretty plz :)


can you look into which is best?

define best. theoretically all of the added features should be checked:

Differences from XMLHttpRequest

XMLHttpRequest Level 2 adds the following new features:

  • The ability to make cross-origin requests.

  • The ability to make anonymous requests — Referer, origin, and credentials are not part of the request.

  • The ability to register for progress events. Both for downloads (put listeners on the XMLHttpRequest object itself) and uploads (put listeners on the XMLHttpRequestUpload object, returned by the upload attribute).

  • The ability to override the media type and character encoding of the response through the overrideMimeType() method.

  • The ability to set a timeout for the request.

  • The ability to transfer ArrayBuffer, Blob, File and FormData objects.

  • The responseType and response attributes.


ideally we see if there is a heuristic which is indicative of all those.. or at least all those features that you'd care about.

it's a bit of an inference but that's kinda what we gotta do.. otherwise we're doing conformance testing against the spec.


trying this on testling...


just tested everything and if a browser supports one of the 3 it supports ALL of them.
EXCEPT for Opera Next.. which supports WithCredentials and FormData but not ProgressEvent so........



we need a network-xhr2.js for feature-detects/

and hopefully by the time opera 12 ships they have ProgressEvent

which means we can just ask for one of these..

btw my gist.. and results in a comment blow.


thx for reporting! wooo

we can use any three of those as an XHR2 test now. PRs accepted!



@paulirish paulirish closed this in 22912a1
@phistuck phistuck referenced this issue from a commit
@phistuck phistuck xhr2 test. fixes #385 18ecf42
@patrickkettner patrickkettner referenced this issue from a commit in patrickkettner/Modernizr
@paulirish paulirish xhr2 test. fixes #385 68ab135
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.