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 trialstacy peairs
231 PointsWhy won't the image randomize? I use chrome w/windows, ctl F5 didn't work...
it's not the end of the world but is there a way to make chrome (most recent version) stop the cache'ing? I did go into setting / advanced settings / clicked / clear browser/ stop Cached images and files / all the time still no worky any thoughts? thanks a ton
1 Answer
Steven Parker
231,269 PointsOne way that has worked for me is to use a bit of JavaScript to add a query string onto the URL with a random number in it. Then it never matches anything in the cache.
document.querySelector("img").src += "?nocache=" + Math.random();
This particular script will only work for the first image on the page.
stacy peairs
231 Pointsstacy peairs
231 PointsHey that's awesome.... thanks for getting back to me sooooooo quick and so late.... Go To Bed! hahahh
Steven Parker
231,269 PointsSteven Parker
231,269 PointsHeaded there now. Happy coding!