0

I'm trying to make a download button for my qr code generator app

downloadBtn.addEventListener('click', ()=>{
    let imageWidth = qrImage.naturalWidth;
    let imageHeight = qrImage.naturalHeight; 
    canvas.width = imageWidth;
    canvas.height = imageHeight;
    let canvas = document.createElement('canvas');
    let a = document.createElement('a');
    let ctx = canvas.getContext('2d');
    ctx.drawImage(qrImage, 0,0, canvas.width, canvas.height);
    a.href = canvas.toDataURL();
    a.download = new Date().getTime();
    a.click();
})

So i implemented that code, but still doesn't work

I want it to download the image source of my qr generator

  • Does this answer your question? [Tainted canvases may not be exported](https://stackoverflow.com/questions/22710627/tainted-canvases-may-not-be-exported) – Kaddath Nov 15 '22 at 16:37

0 Answers0