Download Attribute

Overview

The download attribute specifies that the target will be downloaded when a user clicks on the hyperlink.

The value of the attribute will be used for the name of the downloaded file. There are no limitations on allowed values. File extension (.html, .png, .jpg, .pdf, .txt, etc.) will be automatically detected by the browser and will be added to the downloaded file.

Note: download is an optional attribute. However, this attribute is only used if the href attribute is also set. If the attribute is not set, the original link filename is used.

Syntax & Example

<a href="example.html" download="file_name">

For instance, if you are going to download a file with a “New_File” filename, the download attribute should read as follows

<a href="example.html" download="New_File">

The downloaded file will be named “New_File.html

A note to our visitors

This website has updated its privacy policy in compliance with changes to European Union data protection law, for all members globally. We’ve also updated our Privacy Policy to give you more information about your rights and responsibilities with respect to your privacy and personal information. Please read this to review the updates about which cookies we use and what information we collect on our site. By continuing to use this site, you are agreeing to our updated privacy policy.