Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!