The following is a detailed explanation of the html download function. I think it is quite good. Now I will share it with you and give you a reference. Let's take a look at the new project. The first time we completed the integration of frontend and backend separation, we naturally encountered a lot of pitfalls.
Let's talk about one of the pitfalls we encountered on the first day.
-- About download...
In the past, we all liked to use tags. At first, I used the tag and href attribute to simulate the download function at the image address. It turns out that you click this ghost thing to open a new image, not to download it.
Then I read an article and opened the door to the new world of my baby.
Download attributes
The tag must have the href attribute. The browser will automatically detect the correct file extension and add it to the file (. img,. pdf,. txt,. html, and so on ).
For example:
You can also customize the downloaded file name
WageSoCute.jpg ">
However, this method also has great limitations.
One is its compatibility, based on the data provided by W3C.
In this case, it seems that this attribute is generally practical for the moment.
Another pitfall is that I haven't stepped on yet, that is, cross-domain issues. When I stepped on, I updated it ..
To sum up, this download is a good thing, but it looks likePoor SupportI don't know what will happen to him in the future. After all, it is still a new attribute of the tag. Let's wait. Now, at least we know that there is such a thing.
The above detailed explanation of the html download function is all the content that I have shared with you. I hope you can give us a reference and support the script home.
Address: http://www.cnblogs.com/w-age666/archive/2016/05/04/5458342.html