![]() The above code is to achieve file download directly by writing a tag, we can also achieve it through js, the code is as follows: const a = document.createElement('a') In the above example, we clicked download and found that we jumped to the homepage of Google, and did not actually download the file.īecause a tag download can only download files of the same origin, if it is a cross-domain file, including pictures, audio and video and other media files, it is a preview and cannot be downloaded. Let’s first look at the sample code: download This method is the simplest and the most commonly used method. a labelįile download is achieved through the download attribute of the a tag. ![]() ![]() The file download involved in the front-end still has many application scenarios, so how many ways are there for the front-end file download? What are the advantages and disadvantages of each method? Let’s introduce them one by one. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |