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

JavaScript JavaScript Basics (Retired) Working With Numbers The Mad Libs Challenge Revisited

Charles Willden
Charles Willden
12,357 Points

Chrome won't run updated files, runs from cache

I was working on this challenge and found that in Chrome, the previews would always show the same thing even after adding new lines to the javascript file and saving before hitting Preview Workspace. I even changed the title in the html and saw no change. It wasn't until I cleared the browser cache that any changes took hold in the preview. Any guidance on how to prevent this problem? I never ran into this problem in any of the HTML or CSS courses.

Ionut Ghita
Ionut Ghita
1,951 Points

I refresh the page when this happens. It works for me (meaning that it doesn't show the same thing all the time).

Ionut Ghita
Ionut Ghita
1,951 Points

I refresh the page when this happens. It works for me (meaning that it doesn't show the same thing all the time).

4 Answers

Charles Willden
Charles Willden
12,357 Points

Figured out I can prevent caching in dev tools from the Settings menu or from the Network tab ("disable cache" checkbox), but this only works when dev tools is open. There are plugins for Chrome, like Cache Killer that can suppress caching more generally, but I can't install plugins on my work computer.

It may be a good idea to run this lesson on a personal computer to verify whether it is the settings on your work computer, or if you left out part of the statement, such as a semicolon at the closing of the statement.

Charles Willden
Charles Willden
12,357 Points

No, it was definitely an issue with caching. It takes the most recent revision after clearing the cache and also when disabling the cache with dev tools open. What I found from my Google search is that this is a very common problem for web developers and there's several solutions. The Chrome plugins seems like the best, but that won't work in my situation.

Aaron Pedersen
Aaron Pedersen
5,856 Points

I can usually just hit the refresh button in the browser and it works.

Caching is one of those things that you almost can't prevent. The whole point of a browser is help web application load quicker, so it uses the caching principal by default in order to do that. There might be tools out there that disable it, but you don't want to disable it completely, otherwise, you could experience a lot of slow site loading while you are surfing the web. You can also look into a good IDE that allows you to clean and rebuild your projects. This will get rid of the problem with a push of a button. I use Eclipse and Netbeans a lot, since I program in Java extensibly. There are options for this in both.