Home > Web Front-end > JS Tutorial > body text

How to Make PDF Links Downloadable via HTML5?

Linda Hamilton
Release: 2024-10-22 21:34:29
Original
588 people have browsed it

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>
Copy after login

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:

  • [Downloading Resources in HTML5: a download](http://updates.html5rocks.com/2011/08/Downloading-resources-in-HTML5-a-download)

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!

source:php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!