MitchCool1
MitchCool1

Reputation: 329

HTML image not working

I have a grid of images on my website, but some of the images randomly don't work. All the image sources are links, which are all generated from the same place. I'll show an example, with an image that works and one that doesn't:

http://codepen.io/anon/pen/mJmaZE

As you can see the second image doesn't work, but if you visit the source link the image is there. Why is this happening?

Upvotes: 0

Views: 81

Answers (3)

m4n0
m4n0

Reputation: 32355

The syntax of source URL is wrong.

Current syntax

src="steamcommunity-a.akamaihd.net/xx"

This is a relative path which will point to http://codepen.io/anon/pen/mJmaZE/steamcommunity-a.akamaihd.net/xx

Correct syntax

src="http://steamcommunity-a.akamaihd.net/xx" 

which will request the intended CDN url.

Upvotes: 0

Remigius Stalder
Remigius Stalder

Reputation: 2170

the content of the src attribute is lacking the prefix http:// . when addint it, it displays the image correctly. otherwise, it interprets the URL as a relative URL in the context of the embedding web page.

Upvotes: 1

Boldewyn
Boldewyn

Reputation: 82814

The second image is missing the http:// part. That means, the browser doesn't know it should look at a different server, but tries to access it at the same server, where the HTML file is hosted.

Upvotes: 3

Related Questions