1

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

Horia Toma
  • 1,099
  • 2
  • 17
  • 29
  • 1
    Add the correct headers on your server ;-) – TheHippo Mar 17 '14 at 16:54
  • headers look ok to me: `HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Disposition: filename=grammars-20140317-144045.zip Cache-Control: no-cache Expires: -1 Pragma: no-cache Vary: Accept-Encoding Content-Encoding: gzip Content-Type: application/octet-stream Transfer-Encoding: chunked Date: Mon, 17 Mar 2014 17:14:57 GMT` – Horia Toma Mar 17 '14 at 17:25
  • it's rather the request that's missing something? – Horia Toma Mar 17 '14 at 17:28
  • I don't think so. Please take a look at this [question](http://stackoverflow.com/q/6587393/617996). – PrimosK Mar 24 '14 at 13:10
  • I've seen this one, definitely the same problem, Chrome issue – Horia Toma Mar 24 '14 at 14:53

1 Answers1

1

Please try it like this:

window.open(url, '_blank')
PrimosK
  • 13,848
  • 10
  • 60
  • 78