HTML Introduction to HTML and CSS 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

Oscar Gomez
Oscar Gomez
3,823 Points

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

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.

Ivan Poch
Ivan Poch
6,689 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