Hi
I’m using Angular 8 and the the ability to download a zip file from network path fails on a CORS related issue
I’m getting the following error message: “Access to XMLHttpRequest at ‘file://IPAddress/d$/***/Output.zip’ from origin ‘http://localhost:4200’’ has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.”
Here is the function which I’m using to download the zip file:
downloadFile(filePath: string) {
return this.http.get(filePath, {
responseType: 'arraybuffer'
}).subscribe(data => {
const blob = new Blob([data], {
type: 'application/zip'
});
const url = window.URL.createObjectURL(blob);
window.open(url);
});
}
I already spend much time on it.
Can you please assist?
Best Regards,
Nadeem Bader