0

I want to show some images from another websites in my website. This is the code:

<img src="https://www.alaedin.travel/Files/Original/Hotels/mashhad/aban/Alaedin-Travel-Agency-Mashhad-Aban-Hotel-Facade-1.jpg">

Images arent shown in Chrome. But I can see them in FireFox. whats the problem?

Hajar
  • 3
  • 1

1 Answers1

0

The issue is with chrome being stuck in redirection as you can see in the logs: chrome network log I am not sure why is that behavior. I suggest that you store these pictures in a static folder as a temporary solution if you can, or try using fetch requests while enabling CORS.

Etsh
  • 116
  • 2
  • 11
  • 1
    Thanks for answering. Could you please help me with fetch requests while enabling CORS? I dont know any thing about it. I'm using an API and then I store all the data in my DB. The image address is read from my DB. – Hajar Apr 10 '21 at 04:34
  • @Hajar Enabling CORS is simple but tricky, and I also think both websites needs to have it enabled in order to have sharing enabled. You can read more about CORS in this [MDN Article](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS). Enabling CORS fairly similar throughout back-end technologies, so just search how you could enable CORS using your backend technologies. As for fetching images, try this [link](https://stackoverflow.com/questions/50248329/fetch-image-from-api). – Etsh Jun 06 '21 at 09:45