Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

153
Visualizações
Making Screenshot Script TypeError: Cannot read properties of null (reading 'cloneNode')

Whenever I press Download ScreenShot Button I get this error Uncaught (in promise) TypeError: Cannot read properties of null (reading 'cloneNode') at d (dom-to-image.min.js:2:1519) How do I fix this - HTML Code for understanding my problem - https://jsfiddle.net/m5gneoL7/

 <button id="dload_img">Download</button>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/dom-to-image/2.6.0/dom-to-image.min.js" integrity="sha512-01CJ9/g7e8cUmY0DFTMcUw/ikS799FHiOA0eyHsUWfOetgbx/t6oV4otQ5zXKQyIrQGTHSmRVPIgrgLcZi/WMA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
  <script src="http://cdn.jsdelivr.net/g/filesaver.js"></script>
  <script>
    $(document).ready(function() {
      $("#dload_img").click(function() {
        domtoimage.toBlob(document.getElementById('whole_page','')).then(function(blob){
          window.saveAs(blob, "output.png");
        });
      });
    });
  </script>

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

In your HTML, change:

<div class="whole_page">

to:

<div id="whole_page">

Because you are using document.getElementById to find whole_page, it needs to be the id of the div. If you really wanted to find the div by a class, then change the javascript to:

document.getElementsByClassName('whole_page')[0]

([0] because it returns an array)

I tried your fiddle and that does solve the immediate problem, but that just uncovers other breakage.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda