I'm trying to download the image from a canvas tag. I get from var image = canvas.toDataURL()
base64, and thought that this could be used to create a <a>
tag, and adding inside the tag download = "image.png"
and href = img
and simulate a click. I've googled around, but didn't find quite what I was looking for.
I found an answer actually to this question, lol.
var link = document.createElement('a');
link.href = 'images.jpg';
link.download = 'Download.jpg';
document.body.appendChild(link);
link.click();
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.