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!