jpillora / xdomain

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

xdomain does not support Fetch API? #198

Open hihl opened 7 years ago

fewiki commented 7 years ago

I have this question too

neatshell commented 6 years ago

Thanks for have opened this issue cause I've lost an entire day before realizing that my stuff wasn't working because of Fetch. I've substituted it with axios and now everything works perfectly ;)

udayklu commented 4 years ago

HI, Before including Xdomain.min.js in the project while fetching the stream(MemoryStream) response from WEB API using ActionResult and then converted that blob data using below code snippet into pdf file format.

var blob = new Blob([res._body], { type: 'application/pdf' }); this.fileUrl = this.sanitizer.bypassSecurityTrustResourceUrl(window.URL.createObjectURL(blob)); if (callingFrom === 'download') { let element = this.downloadLink.nativeElement; element.href = this.fileUrl.changingThisBreaksApplicationSecurity; element.click(); } Once I include Xdomain plugin in the project to fix CORS issue stream response is getting junk like below: image

Please help me in this It's taking time but coundn't find any solution. Please respond AQAP.

Thanks in advance.