Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML Introduction to HTML and CSS (2016) HTML: The Structural Foundation of Web Pages and Applications Paragraph Tags

placeimg link not working

I used the https://placeimg.com/400/400/people in the html css tutorial but the website doesn't change pictures when i refresh. I just stays on the same picture of the same person

?

6 Answers

I had the same problem and someone on this forum posted solution: you need to post this in your index.html after </footer> and before </body>:

<script> document.querySelector("img").src += "?nocache=" +Math.random();</script> 

Thanks alot <333

Not posting an answer, but just informational as of today... I use the Brackets editor (Chrome as my browser), and the Live Preview in the editor is having the same kind of issue. I would not worry too much about an error on your own part if the image comes up the first time.

And for the original poster - take care using snippets like that given in an answer. Yea, it "works" on this issue, but it has absolutely nothing to do with the subject matter. If anything, it is leaps and bounds ahead of where this course is, and miles away from where you should be messing with at this point lol. The issue is most likely with the browsers, and not really with the code from you or Treehouse. Once Treehouse and the instructor see enough comments regarding this issue, they will either make a comment in the Teacher's Notes section, or they will do an update video if the issue is big enough (this is not). Just throwing this out there in case you, or anyone else, is serious about learning and getting what they are paying for lol.

Oscar Gomez
Oscar Gomez
6,797 Points

<script> document.querySelector("img").src += "?nocache=" +Math.random();</script> Works!! Thx!!

Ivan Poch
Ivan Poch
9,839 Points

Mostly it happend to me in chrome, that is why you should use more than one web browser when developing website. If it do not load new image go to browser settings and clear cache or cookies i do not remember which one helped me. In my firefox it load always a new image. Of course the script above should work well too.

Windows: ctrl + F5 Mac/Apple: Apple + R or command + R Linux: F5

That works Perfect. Thanks!

Janie James
Janie James
153 Points

Try ctrl + F5 in Chrome (Windows 10)

Looks like Chrome minimizes refresh of images. Good luck