IE11 not honoring responseType: 'json'
See original GitHub issueI am trying to execute a simple xhr.get call and use the json object in response.body
. This works fine in Chrome and Firefox, but in IE11; it does not convert the response.body
into an object, but leaves it as a String. Here it only converts the response.body if isJson
is set in the options ahead of time. I have no need for that property besides to hack it to work for IE11. Shouldn’t isJson
be set to true if the responseType is ‘json’ or the json property exists?
Returns a string in response.body in IE11
xhr.get({
url: myUrl?parameters,
responseType: 'json'
}, callback);
My hack to convert response.body to an Object in IE11
xhr.get({
url: myUrl?parameters,
responseType: 'json',
json: true
}, callback);
It looks like Microsoft is aware of it, but no fix coming for IE11.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Why does setting XMLHttpRequest responseType before ...
Show activity on this post. Running new XMLHttpRequest(). responseType = "json" in the console throws an "InvalidStateError" exception in Firefox 26 and IE11 ......
Read more >JSON stringify not working in IE11
Fixes LLK#654 IE does not honor responseType: 'json', and will not parse responses as JSON unless json data is present in the request....
Read more >~soapdog/webextension-remove-twitter-trending-topics: initial ... - git
Since Spidermonkey does not fully parse the + // contents of a function ... new Error("api-metadata.json has not been included in browser-polyfill"); +...
Read more >IE 11 asks to open or save JSON response - jQWidgets
and it works ok on IE and still works on Chrome. But in your experience is this the past way to handle this...
Read more >Unable to retrieve blob from SQL database in IE11
responseType ='arraybuffer'" when I run it under IE11. ... I've googled the error message but could not figure out how to solve the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
on IE don’t use
xhr.responseType = 'json';
and parse yourself the responsevar res = JSON.parse(xhr.responseText);
It has seemed pretty odd to me that you have to specify
json: true
even when the server is puttingContent-Type:application/json
headers on the response.