Google Chrome not always reliable when it comes to clearing its cache. In this article we'll see some ways to fix that.
I like Chrome for development. I know where things are in it and I'm good at using Chrome Dev. Tools to troubleshoot issues. But Chrome is notorious for not fully clearing it's cache.
Clearing the entire browser cache is a pain since it often removes things that make life easier on the web. Worse yet, it doesn't always work. Using Ctrl-F5 by itself often won't work. Disabling the Chrome cache in Dev. Tools sometimes won't work.
A Universal, but Flawed Solution
Here's a method that's very reliable, but a little bit of a pain to implement. Put this in your
This has the advantage of working in any browser, though it requires the
Another problem with this solution is that if you're working fast, the minute may not be up when you test your changes, and it's way too annoying to set a one-minute timer every time you load a page, then wait for it to go off before testing your changes.
Another quick way to convince Chrome not to cache your pages is to add a query parameter to the end of the URL. Say your page is at this URL:
You can add a query parameter to the end of the URL to make Chrome think it's a different page:
Don't forget the question mark or you'll end up and the error (page-not-found) page. If the page is a MODX manager page, you usually need to add an ampersand instead of the questions mark and tack your parameter on the end, like this:
One drawback of this method is that you need to use a different number each time you reload the page. It also adds a new page to the browser cache every time you do that, possibly pushing out previously cached pages you might rather keep. To be honest, I don't know if this method prevents caching for the elements that get loaded with the page, such as CSS and JS files loaded in the code. I've never checked because the method we'll see in the next article is a much better way to go.
In the next article, we'll look at preventing Chrome from caching things using a handy Chrome extension.
Looking for high-quality, MODX-friendly hosting? As of May 2016, Bob's Guides is hosted at A2 hosting. (More information in the box below.)