xhr icon indicating copy to clipboard operation
xhr copied to clipboard

Doesn't auto choose XDR when making a cross-domain request

Open gkatsev opened this issue 10 years ago • 8 comments

As a user of XHR, I would expect it to realize when the request will require CORS and choose to use XDR. This is mostly an issue on browsers like IE8 and IE9 where a CORS request requires the usage of XDomainRequest.

gkatsev avatar Sep 23 '15 18:09 gkatsev

Thanks for reporting. I had that issue too. Over a year ago, when I was not involved with this project yet.

It's a wontfix kind of issue. It only (not mostly) affects really old IEs and if you are using xdr you have to be aware of a lot of limitations anyway. Eg. Can't set or read any headers.

Detecting if the request is cross domain is also not as easy as we'd want to. So it'd be a big chunk of code added for eberyone while only very few users have any doubts if they are crossing domain boundaries or not on a particular request.

Having said all that, I'm open to pull requests with a small and elegant solution I couldn't come up with ;) But it'd have to be complete. No half measures like handling only absolute urls or so. It should require no documentation.

naugtur avatar Sep 23 '15 19:09 naugtur

Do you think something like https://github.com/videojs/video.js/blob/stable/src/js/xhr.js#L80-L84 is sufficient or are there some more usecase you can think off that won't be covered?

gkatsev avatar Sep 23 '15 19:09 gkatsev

There's a better implementation than what I linked above in videojs/video.js#2633

gkatsev avatar Sep 23 '15 20:09 gkatsev

That's still a lot of code for a library of the size of xhr anyway. We could distribute a separate library with that feature (assuming it doesn't exist already)

it's like with the qs package. We got requests to include that too, but it's better off as an optional thing you can add.

naugtur avatar Sep 23 '15 20:09 naugtur

What about making it in an require('xhr/ie')? or require('xhr/cors')?

gkatsev avatar Sep 23 '15 21:09 gkatsev

Yes, xhr/ie was considered before. This is yet another reason to finally do that. Dropping all that ie-induced mess to a separate file would be such a relief.

naugtur avatar Sep 24 '15 17:09 naugtur

Should this be closed?

ArtskydJ avatar Nov 18 '16 17:11 ArtskydJ

I'm keeping it open because people don't search closed issues and this is a wontfix. I'll close it when we separate out old IE support

naugtur avatar Nov 18 '16 18:11 naugtur