There is something wrong with the code

var image = new Image();
image.src = canvas.toDataURL("image/png");
var link = document.createElement('a');
link.href = image;
link.download = 'Download.png';
document.body.appendChild(link);
link.click();

      

When I use this script it returns me a download error

(File not found)

      

Why?

+3


source to share


1 answer


change

link.href = image;



to

link.href = image.src;

+3


source







All Articles