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 trialSam Weeks
Front End Web Development Techdegree Student 16,699 Pointsplaceimg.com wont refresh new img or display at all on one of my pages i've used the java script code no luck
<h1>Resume</h1> <img scr="http://placeimg.com/200/200/tech" alt="Sam Weeks, Web Developer">
<img src="https://placeimg.com/400/400/any" alt="Drawing of Jane Smith" class="profile-image">
first link wont open up any image at all 2nd will only upload once until i clear my cache and cookies
i've tried the javascript code on other answered questions similar to this but still no luck any feed back would be most appreciated
4 Answers
Sam Weeks
Front End Web Development Techdegree Student 16,699 Pointsim very new to this i researched how to clear cache and cookies but not to prevent
deebird
7,558 PointsYour first link has a typo, scr should be src
Sam Weeks
Front End Web Development Techdegree Student 16,699 Pointsthank you deebird i did change this and place-img still didnt seem to register, once it uploaded one image it wouldn't refresh to another random one like its supposed to generate.
deebird
7,558 PointsAre you doing anything to prevent caching?
Matthew Jergens
4,066 PointsI found the following script on another Treehouse forum, and it fixed the problem for me. <script> document.querySelector("img").src += "?nocache=" +Math.random();</script>
deebird
7,558 Pointsdeebird
7,558 Pointsbrowsers generally cache css files to increase performance. If you want it to clear every time you could use a cache buster, you can do this with php, js or sass (for bg imgs). If you just want to clear the cache for working on your local computer you can just modify your browser settings.