Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

154
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda