(HTML) Download a PDF file instead of opening them in browser when clicked

404Error picture 404Error · Jul 22, 2011 · Viewed 276.9k times · Source

I was wondering how to make a PDF file link downloadable instead of opening them in the browser? How is this done in html? (I'd assume it's done via javascript or something).

Answer

Sarim picture Sarim · Sep 7, 2013

With html5, it is possible now. Set a "download" attr in element.

<a href="http://link/to/file" download="FileName">Download it!</a>

Source : http://updates.html5rocks.com/2011/08/Downloading-resources-in-HTML5-a-download