简体   繁体   中英

Picture Download Button with HTML not working



I am still working on a problem to get a html download button that can download a picture like this one:

https://instagram.fhrk1-1.fna.fbcdn.net/v/t51.2885-19/59381178_2348911458724961_5863612957363011584_n.jpg?_nc_ht=instagram.fhrk1-1.fna.fbcdn.net&_nc_ohc=tBa1BvKa4J8AX_ood-9&oh=f1a9a51e56f995f41cb7c3175e83cd53&oe=5E8E1D25

I have tried it with a normal w3 html button like this:

 <!DOCTYPE html> <html> <body> <p>Click on the w3schools logo to download the image:<p> <a href="https://instagram.fhrk1-1.fna.fbcdn.net/v/t51.2885-19/59381178_2348911458724961_5863612957363011584_n.jpg?_nc_ht=instagram.fhrk1-1.fna.fbcdn.net&_nc_ohc=tBa1BvKa4J8AX_ood-9&oh=f1a9a51e56f995f41cb7c3175e83cd53&oe=5E8E1D25" download> <img src="https://instagram.fhrk1-1.fna.fbcdn.net/v/t51.2885-19/59381178_2348911458724961_5863612957363011584_n.jpg?_nc_ht=instagram.fhrk1-1.fna.fbcdn.net&_nc_ohc=tBa1BvKa4J8AX_ood-9&oh=f1a9a51e56f995f41cb7c3175e83cd53&oe=5E8E1D25" alt="W3Schools" width="104" height="142"> </a> <p><b>Note:</b> The download attribute is not supported in Edge version 12, IE, Safari 10 (and earlier), or Opera version 12 (and earlier).</p> </body> </html>

In my case its not working. I think thats only a way of downloading something whats locally saved. I don´t want to save it local to get it downloaded by a user.

Thank you

You should set the image path in the download attribute. Like this:

<a href="image.png" download="image.png">
   <img src="image.png" alt="W3Schools" width="104" height="142">
</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM