Download external zip file from angular triggered on a button action

1.8k views Asked by At

I'm writing an angular app and I allow users to download zip files by clicking on a button that calls on a controller method via ng-click.

Inside the angular method, I'm calling window.open(url, '_self', false) (the same applies for window.location.assign(url))

The zip download is working fine, however I'm seeing this warning in Chrome:

Resource interpreted as Document but transferred with MIME type application/octet-stream

I'm stuck to using a button as from what I've seen <a href="url" download> will do the job.

Any ideas on how this can be solved?

Thanks

1

There are 1 answers

0
PrimosK On

Please try it like this:

window.open(url, '_blank')