HTML <a> Download How to use properties

Source: Internet
Author: User
Click Download file or image is we look for resources on the page of the daily operation, then we ourselves in the design of the HTML page, if we need to implement the ability to let others download files, how should we do? In fact, the implementation of this function is not very complex, but it is very simple. This article will give you a detailed introduction to the download attribute in a tag, as long as the master of this property can be achieved by clicking on the download file images and other functions.

An example of a simple HTML code with a tag download property is as follows:

<! DOCTYPE html> 

My local test results are as follows:


I accessed it using Firefox and successfully downloaded the open image. I believe that if you do your own testing, the download attribute has some concept. Here the value of the a tag href is the address that you want to download a file or picture. The value of download indicates that you want to download the saved file name or image name.

However, it is important to note that the a download attribute in HTML does not work in all browsers. Currently a download property is only available in Firefox and Google Chrome. The rest of the browsers, such as IE, Safari, and opera, are useless.

In summary, so want to achieve click to download a file or a picture as long as the download attribute usage in a tag is good, if you only add the file address of href in the a tag and no download attribute, then it will only appear the effect of preview and cannot download!

This article has certain reference value, hoped to have the need friend to have certain help!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.