Why not html2canvas renders?

Hello! html2canvas renders me only a white background with a resolution of my canvas. What could be the problem?
Use adobe muse. Fot the code snippet:

html2canvas(document.querySelector("#u2044_img")).then(canvas => {
 var image= canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
console.log(image);
 window.location.href=image;


5dfa6d5f99e6c519724021.png
April 3rd 20 at 18:35
2 answers
April 3rd 20 at 18:37
Then it is better to do so
const doCapture = element => {
 html2canvas(element).then(canvas => canvas.toBlob(blob => {
 window.location = URL.createObjectURL(blob);
}));
};
April 3rd 20 at 18:39
Friends, of course, the toaster people will not help, so I decided here, tin I cool
<script src="html2canvas.js"></script>
the <script>
 function doCapture(){
 html2canvas(document.querySelector('#pslideshowu1013')).then( canvas =>{
 var img=canvas.toDataURL("image/png").replace("image/png","image/octet-stream");
console.log(img);
window.location.href=img;
});

}
</script>
 <button onclick="doCapture();">222</button>

All!After that, I have no empty white screenshots not appearing...cheers!
Just don't be stupid and think your HTML is not loaded to run the script in any way? All manipulations with DOM elements must be performed AFTER the document has been created. - Abdiel.Blan commented on April 3rd 20 at 18:42
@Abdiel.Blan, not scary - ryan79 commented on April 3rd 20 at 18:45
@ryan79scary actually :) need the DOM to work like this:
function onReady() {
//...
}
document.addEventListener("DOMContentLoaded", onReady);
- clarissa_Flatl commented on April 3rd 20 at 18:48
guys, I understand you!well done! - ryan79 commented on April 3rd 20 at 18:51
@Abdiel.Blan, cool! - ryan79 commented on April 3rd 20 at 18:54

Find more questions by tags CSSJavaScriptjQueryHTMLWeb Development