IE11 - XMLHttpRequest incorrectly throws InvalidStateError when setting responseType - by Scott K Hunter

Status : 


ID 795580 Comments
Status Active Workarounds
Type Bug Repros 4
Opened 7/31/2013 12:42:59 PM
Access Restriction Public


This JavaScript throws an InvalidStateError:

var xhr = new XMLHttpRequest();
xhr.responseType = "blob";

This not compliant with the XHR spec:

which says that "InvalidStateError" is only thrown when LOADING or DONE.  In this case, the state is UNSENT.
Sign in to post a comment.
Posted by jay developer on 6/18/2015 at 8:05 AM
This is an issue for myself as well.. Works in IE9 but not IE10 and IE11...

A solution/fix is needed.

Setting responseType is breaking consistently.. This is not correct.

var oReq;
oReq = new XMLHttpRequest();"GET", url, true);
oReq.setRequestHeader( 'Authorization', 'Bearer ' + securityToken);
            if(typeof Uint8Array !== 'undefined') {
                // if this fails, try using ActiveXObject
                oReq.responseType = 'arraybuffer';
                //oReq.setRequestHeader("Accept-Charset", "x-user-defined");
                oReq.onload = function(e) {
                    if(typeof console !== 'undefined')
                    var arraybuffer = oReq.response;
                    var data = new Uint8Array(arraybuffer);
                    var arr = new Array();
                    for(var i = 0; i != data.length; ++i) arr[i] = String.fromCharCode(data[i]);
                    var wb =""), {type:"binary"});

Posted by Alex Tsang on 6/3/2015 at 8:16 AM
I can confirm on my computer, running IE 11 (Version 11.0.9600.17801, update version 11.0.19).

It has been almost 2 years since Microsoft received this report, please fix this bug.
Posted by Microsoft on 8/1/2013 at 1:58 PM
Thank you for your feedback.

We are currently unable to reproduce this issue as described.

We value your feedback. If you have additional information that can help us recreate this issue — such as a specific url, more detailed steps, test results from different machines, or additional conditions — please reactivate the bug or submit a new bug with more details on how to reproduce the issue. You can also read the guidelines at regarding filing a good bug report.

Best regards,

The Internet Explorer Team