0

I have a link in angular to download a file but still it redirects to that path

this is the link

<a target="_self" href="../../public/temp/ecs.pdf" download="foo.pdf">down</a>

should we have to add anything else?

Clive
  • 36,918
  • 8
  • 87
  • 113
  • _self is only useful to override an existing base target (it's the default otherwise), it doesn't do what you think it does. You'll need to change the headers on the file that's served in order to force a download – Clive Nov 29 '14 at 10:14
  • how to change the headers. can you do example? – abel dharmaraj Nov 29 '14 at 11:36
  • I don't know what server technology/language you're using, so not really. I just came across [this](http://stackoverflow.com/questions/11353425/force-a-browser-to-save-file-as-after-clicking-link) though, if you can mandate HTML5 for your app that's a viable alternative. Otherwise search for "Force file download [name of language]" – Clive Nov 29 '14 at 11:38

0 Answers0