Interactive online courses HTML Academy
2026-03-09 12:56 Diff

Many links allow us to reach other pages or places on the page. However, you can link to anything that has its own URL, which could be a file such as an image, video, PDF or audio file. In this case, when you click on the link to the file, your browser may offer to download it.

However, if the browser is able to process files of this type, the contents of the file will open directly in the browser. This occurs most frequently with images. But lately, browsers have learned how to open PDF files and many other file types.

In order to prevent files from being opened directly in the browser, the <a> tag has the download attribute, which helps in particular with downloading the file.

<a href="file.pdf" download>The browser downloads me, but it will not attempt to read me</a>