Home >Web Front-end >JS Tutorial >How to Make PDF Links Downloadable via HTML5?
Making PDF Links Downloadable
When working with PDF files, it can be inconvenient to have them automatically open in a browser when clicked. Fortunately, HTML5 offers a straightforward solution to make PDF links downloadable instead.
How to Make PDF Links Downloadable
To prevent PDF files from opening in the browser, simply add a "download" attribute to the element that links to the file:
<code class="html"><a href="http://link/to/file" download="FileName">Download it!</a></code>
By adding the "download" attribute, the browser will automatically prompt the user to download the PDF file to their local computer instead of opening it in the browser window.
Source:
For more information and implementation details, refer to the following source:
The above is the detailed content of How to Make PDF Links Downloadable via HTML5?. For more information, please follow other related articles on the PHP Chinese website!