jpillora / xdomain

A pure JavaScript CORS alternative
https://jpillora.com/xdomain/
3.12k stars 269 forks source link

ng-file-upload compatibility (ie8/9) #151

Closed undeidentity closed 9 years ago

undeidentity commented 9 years ago

Hi jpillora. I am planning to use xdomain and ng-file-upload The problem is both plugin modify XHR object(or something like that) so they have conflict. The file loads libraries in [xdomain.js -> ng-file-upload-shim.js -> angular.js -> ng-file-upload.js] order. Is there any way to use them in the same time? DEMO : http://swb4u2.cafe24.com/xngf/test.html I know there is another solution (https://github.com/jpillora/xdomain/issues/74) but it's not proper to me.

xdomain issues https://github.com/danialfarid/ng-file-upload/issues/218 https://github.com/danialfarid/ng-file-upload/issues/113

ng-file-upload side issue https://github.com/danialfarid/ng-file-upload/issues/760

thanks!

jpillora commented 9 years ago

This is has come up before, multiple libraries can modify XMLHttpRequest, it just depends what they're doing.

Basically, here's why this doesn't and won't work: IE89 don't support FormData (XHR2, ajax file uploads) so they must use flash. However, once you use flash, XHook can no longer see the XHR calls, so XDomain won't work.

Instead of using XDomain, I'd suggest placing a crossdomain.xml at the root of the target domain, this should allow the flash portion of ng-file-upload to work. If not, there should be other flash file uploaders you could try.