function save() {
document.getElementById("canvasimg").style.border = "2px solid";
var dataURL = canvas.toDataURL();
document.getElementById("canvasimg").src = dataURL;
document.getElementById("canvasimg").style.display = "inline";
}
wich will creat a new picture to the right but i want it to download right away i think you would have to use
<a href="x" download>
but what would x be for the download and how would i set it to download on click
The Comment
Does this answer your question? Download data URL file – Harshit Rastogi
i tried to use that code but it says it has an error trying to download im using github so i think it tried to download the site i made. The error in the bottom right
here is the website ive been trying for it to work its a little messy but in the middle is the drawing https://bobzilla07.github.io/web-platform-j1pnv3/
a
tag dynamically (doesn't even have to be visible), set itssrc
as well as adownload
attribute, and call.click()
on it to trigger the download synthetically.<a href="dataURL" download>
?dataURL
. It would have to be set dynamically at runtime (usingsetAttribute
or your framework's method of choice, if any).