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

157
Vistas
CORB warning cause image not loading

Hello I am trying to draw an image on canvas below is my html code

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-type" content="image/png"; charset="UTF-8">
        <img class="single-image" src="https://www.google.com/imgres?imgurl=http%3A%2F%2Fs3.amazonaws.com%2Fpix.iemoji.com%2Fimages%2Femoji%2Fapple%2Fios-12%2F256%2Fneutral-face.png&imgrefurl=http%3A%2F%2Fwww.iemoji.com%2Fview%2Femoji%2F821%2Fsmileys-people%2Fneutral-face&tbnid=AJSgSdgVIo5bRM&vet=12ahUKEwj7mKHix93zAhW3gv0HHSCjAUQQMygAegUIARCNAQ..i&docid=xAafOcEIRf_eyM&w=256&h=256&q=neutral%20emoji&hl=el&ved=2ahUKEwj7mKHix93zAhW3gv0HHSCjAUQQMygAegUIARCNAQ" />

    </head>
    <body>
        <canvas width="320" height="320"></canvas>
    </body>
</html>

and here is my js code:

function copyImageToCanvas() {
    var image = document.querySelector("img");
    var canvas = document.querySelector("canvas");

    var ctx = canvas.getContext("2d");

    ctx.drawImage(
        image, 0, 0
    )
}

setTimeout(() => {
    copyImageToCanvas();
}, 300)

When I load the html page on live server I get the following warning and just an image icon like below: enter image description here

Any help would be appreciated I can't find a solution for that is the problem the warning or I load the image the wrong way?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

try to use the actual link of the image instead. In this case:

<img class="single-image" src="http://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-12/256/neutral-face.png" />

The way to find out is right click on the image and select "Open Image in New Tab". You'll find the actual link of the image in your browser's address bar.

Note: I don't know why you put your <img/> tag inside the <head/>, because it won't work. Please put it in the <body/> tag. If you wanna put your canvas on top of the image, please refer to this answer.

Live: https://playcode.io/826949

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