I made the code and with liveserver I can download it, but when I open it without the VisualStudio extension, the following error appears in the console:
Uncaught (in promise) DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
HTML Code HTML
document.getElementById("dl-png").onclick = function() {
const screenshotTarget = document.getElementById("htmlContent");
html2canvas(screenshotTarget).then((canvas) => {
const base64image = canvas.toDataURL("image/png");
var anchor = document.createElement('a');
anchor.setAttribute("href", base64image);
anchor.setAttribute("download", "Cartão_Aniversário-" + nameClient.value + ".png");
anchor.click();
anchor.remove();
});
};
I want to download after changes, but the page is blank