0

I've published a site through Azure that doesn't want to display absolute URL's of images. Basically, I'm using a free web service to get information about movies. I've added JavaScript to the page to handle setting all of the HTML controls, such as an <img /> tag using document.getElementById("imgID").src = xmlElement.getAttribute("poster");.

Now, this works perfectly when I'm debugging, but not at all when the site is published (as is usually the case...). When I inspect the element and review the source, the source is valid but the "image invalid" icon appears or the alternate text.

An example can be seen here: <img width="300" height="450" alt="Couldn't display image..." src="http://ia.media-imdb.com/images/M/MV5BNTQ5MTgzNDg4OF5BMl5BanBnXkFtZTcwMjAyODEzOQ@@._V1_SX300.jpg" />

enter image description here

Is there something I'm missing with Azure such as something to set in Web.config? Any direction would be appreciated.

tbm0115
  • 410
  • 11
  • 21

1 Answers1

1

Use your own images before complaining about Azure! Your issue is because you are trying to steal images from third party site - namely imdb. The first thing a starting web developer does, it to learn how to protect his/her images being directly referenced from impudent web sites that want to save traffic and efforts and directly refernece images which they don't own.

Your site works locally because there is not Referer header set, or because it is set to Localhost. But once you publish, the Referer header has the correct value of your web site. Then the image request ends up with HTTP 403 status.

Once you put the images in your site and load them from there, it will work. But of course for that, you have to comply to the copyright of the images.

astaykov
  • 30,768
  • 3
  • 70
  • 86
  • 1
    Thank you for the Referer Header note. Further research helped me understand what the issue is. The following question, I feel, provides a clearer explanation. http://stackoverflow.com/questions/3154562/remote-images-displaying-only-sometimes . I'm also currently in contact with the afore mentioned web service to see if they abide by IMDb's License and Site Access conditions which allows the use of copyrightable materials for non-commercial use. If the afore mentioned service does not have explicit permissions, then I will convert to using IMDb's allusively undocumented API for the information – tbm0115 Jul 20 '15 at 14:46