Sign in

Download attribute of a tag, jump directly without downloading

AlphaKiloHotel edited in Fri, 01 Jul 2022

<a href=" https://www.baidu.com/img/bd_ logo1.png?qua=high" download="baidu"><img src=" https://www.baidu.com/img/bd_ Logo1. PNG? Qua = high "width =" 300px "> < / a > it is said on the Internet that chrome can use the download attribute of a tag, but after I add this attribute, I do not download it, but jump to it directly. Why??? Guys, my Chrome is the latest version!!

4 Replies
commented on Fri, 01 Jul 2022

The address of a link's attribute must be a non cross domain address with your front-end JS. If you refer to a third-party website or a project separated from the front-end and back-end, download will not work. You can set up a local service and try the local image

commented on Sat, 02 Jul 2022

Here, a tag's "a" should be the BLOB data of the picture. Through Ajax or fetch and other links to request images, set the data type returned, and get the BLOB data. Or jump to a picture and right-click to save it as

commented on Sat, 02 Jul 2022

Configure the download directory on the server

commented on Sat, 02 Jul 2022

I have also encountered such problems as you. You can refer to download . JS, search can find.

lock This question has been locked and the reply function has been disabled.