Home >Web Front-end >H5 Tutorial >Detailed explanation of the application of download attribute in HTML5_html5 tutorial skills
In traditional HTML, the download of a certain file is like this:
In HTML 5 browsers, the download attribute can be supported, as follows:
download attribute is that when the user downloads a file, what is displayed in the "Save" as file display box in the user's browser
is the
thing displayed in the downloader attribute. , more friendly
In HTML5, the download attribute gives the downloaded file an appropriate name instead of using the native server file name.
Then when the user clicks the link, the download attribute value appears in the download dialog box, replacing the original messy file name. In this example, the file will be downloaded as test.txt. The download attribute also enables a forced download.
This attribute is very useful where there is file interaction. The file name on the server side needs to be extremely unique (the file name in the above example is very unique, isn't it?), but a bunch of garbled characters does not mean anything to the user. Function, the download attribute defines the file name to be more meaningful to the user. The download attribute is just an enhancement, it's not super cool, but it's useful and very easy to add.