Temporary href with download for saving images works once then fails



  • In a site which creates a temporary hrefs in order to download canvas contents as png [code] var containDiv = document.getElementById(canvasId); var canvas = containDiv.childNodes[0]; var imgUrl = canvas.toDataURL("image/png"); var tempLink = document.createElement('a'); document.body.appendChild(tempLink); tempLink.setAttribute("type", "hidden"); tempLink.download = fileName; tempLink.href = imgUrl; tempLink.click(); [/code] This is called twice from a loop to output the images from several canvases. After the site is loaded for the first time it works once for the first canvas but not for subsequent canvases. Further calls to the code produce no output even though the code is being executed and the <a>tags are created (viewed using the developer tools). The same code has been tested and works in Firefox and Google Chrome. Is this a know bug and is there a workaround?</a>


Log in to reply
 

Looks like your connection to Vivaldi Forum was lost, please wait while we try to reconnect.