HTML5 download attributes

Source: Internet
Author: User

Comments: I have been paying close attention to the latest HTML5 innovations. Do you think I am wasting my time? HTML5 brings us many "heavy" features, such as WebSockets, Web Workers, History, Storage, and some tool classes like classList.

However, there are also many small and very good features. One of them is the newly added download attribute. The download attribute allows us to specify a new file name for the browser to download, that is, rename the downloaded file on the client. Instead of the original file name on the link. In fact, the more appropriate name of the download attribute is downloadName.

HTML code

Put the download attribute on link ....


The Code is as follows:
<! -- Use the "budget table" name for download -->
<A href = "/files/adlafjlxjewfasd89asd8f.pdf? 66b11b "download =" budget table "> download expense fee </a>

When you click this link, the new name in the download property value is displayed in the pop-up download box. In this example, the saved file name is "budget table ". In addition, the download attribute can forcibly trigger the download operation, much like the operation we performed on the server using PHP.

The download attribute is very useful when you need to execute a download task. In many cases, the names of files stored on the server are represented by serial numbers to ensure their uniqueness, however, such a name is meaningless to the user. The client rename function of the download attribute makes it easy to change the download file name.


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.