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

157
Views
Images not loading from different website in Safari HTML/JavaScript

I made website where are only pictures in it and I'm displaying those images in my "main" website. In chrome, it works fine but in safari the aren't showing up at all. Even createElement for div isn't working. The problem is this link. Here's my code:

for (let i = 0; i < 11; i++) {
  Draw_Images(i);
}

function Draw_Images(i) {
  var div = document.createElement('div');
  div.id = "meme" + i;
  div.style.borderRadius = "1%";
  div.style.width = "200px";
  div.style.height = "200px";
  div.style.border = "1px solid";
  div.style.padding = "0";
  div.style.margin = "0";
  var divParent = document.getElementById("memes_container").appendChild(div);
  var img = new Image();
  img.src = "https://iynmemes.netlify.app/images_memes/meme" + i + ".jpg";
  img.id = "image_meme" + i;
  img.style.width = "100%";
  img.style.height = "100%";
  img.style.objectFit = "contain";
  img.className = "img-fluid";
  img.alt = i;
  img.crossOrigin = 'anonymous';
  divParent.appendChild(img);
}
<div class="container">
  <div class="row">
    <div class="col-sm">
      <div id="memes_container"></div>
    </div>
  </div>
</div>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

So removing some stuff worked for me. Basically Safari doesn't support navigator.userAgentData so it wasn't displaying images for that reason. So i had to remove it:

for (let i = 0; i < 11; i++) {
  Draw_Images(i);
}

function Draw_Images(i) {
  const isMobile = navigator.userAgentData.mobile;   //REMOVED THIS AND IT WORKED!!
  var div = document.createElement('div');
  div.id = "meme" + i;
  div.style.borderRadius = "1%";
  div.style.width = "200px";
  div.style.height = "200px";
  div.style.border = "1px solid";
  div.style.padding = "0";
  div.style.margin = "0";
  var divParent = document.getElementById("memes_container").appendChild(div);
  var img = new Image();
  img.src = "https://iynmemes.netlify.app/images_memes/meme" + i + ".jpg";
  img.id = "image_meme" + i;
  img.style.width = "100%";
  img.style.height = "100%";
  img.style.objectFit = "contain";
  img.className = "img-fluid";
  img.alt = i;
  img.crossOrigin = 'anonymous';
  divParent.appendChild(img);
}
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!