Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

feat($http): CORS requests support for IE9 #11355

Closed
wants to merge 1 commit into from

Conversation

e-oz
Copy link

@e-oz e-oz commented Mar 18, 2015

IE9 use it's own way to do CORS requests, so for this case (only) we should use XDomainRequest. More about it: http://www.html5rocks.com/en/tutorials/cors/

IE9 use it's own way to do CORS requests, so for this case (only) we should use XDomainRequest. More about it: http://www.html5rocks.com/en/tutorials/cors/
@e-oz
Copy link
Author

e-oz commented Mar 18, 2015

IE9 still supported by AngularJS 1.3 and 1.4, so I decided to submit code I use for CORS requests in IE9. I'm not sure we need MockXdr function to mock cross-origin requests and responses (because nobody will use it except this rare case, which is temporary), so I just tested if it works in existing project in IE9 and it works. Also all tests by "grunt test" are passing and Travis showing green labels for most test jobs (I think "ScriptTimeoutError: Timed out awaiting response to command "switchToFrame" is some bug, not related to CORS).

@pkozlowski-opensource
Copy link
Member

@Jamm this was previously rejected after a long discussion due to the fact that XDomainRequest has several limitations and doesn't behave the same way as XHR in other browsers.

Has anything changed from the last time we were looking into this?

@e-oz
Copy link
Author

e-oz commented Mar 29, 2015

@pkozlowski-opensource this commit has nothing common with one you mentioned. My code doesn't require any changes in config, works fine with $resource (all tests are green) and actually it's contribution from "production" project where this code works fine. Only difference in AngularJS with this code and without this code - CORS requests don't work in IE8 and IE9, and work with this code.
Yes, XDomainRequest have limitations (such as "GET or POST" only, no returned headers), but from my experience, if project requires support of IE9, then in this project programmers will deal with these limitations. As AngularJS current, 1.4, 1.5 are going to support IE9, I thought it will be useful (it takes hours to implement workaround for CORS, there are some non-documented points). It was strange for to discover that AngularJS doesn't have this workaround as IE9 support promised.

@pkozlowski-opensource
Copy link
Member

So, I think that reasoning was that XDomainRequest request has so many limitations that it would be unfair to bring it to the framework as users of IE9 would expect $http to work the same across all the browsers and it wouldn't be the case with XDomainRequest. We just simply can't make IE9 behave as other browsers when it comes to CORS...

@e-oz
Copy link
Author

e-oz commented Mar 29, 2015

There's a huge difference between "doesn't work at all" and "can't use some features". Following your rule, we should declare lack of CORS requests support, because currently they don't work similarly in all supported browsers. Kidding, of course. But if you think AngularJS will be better without it (or this code will make AngularJS worse), feel free to close this PR.

@pkozlowski-opensource
Copy link
Member

Yeh, I think that we are better of by not pretending that we support sth that we can't really support fully due to IE9 limitations :-(

@e-oz e-oz deleted the ie9-cors-support branch June 15, 2015 13:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants