Horia Toma
Horia Toma

Reputation: 1129

Download external zip file from angular triggered on a button action

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

Upvotes: 1

Views: 1931

Answers (1)

PrimosK
PrimosK

Reputation: 13918

Please try it like this:

window.open(url, '_blank')

Upvotes: 1

Related Questions