Saved Changes Slow to Load

Whenever I do any changes, whether it’s CSS, JS, or HTML, it takes an age for it to show on my website. It’s really slowing me down because I do a few things and then have to wait to see what it looks like.

I’d just like to say that this has never happened to me before and I have roughly 10 websites using MODX Revolution.

Anyone come across this before?

1 Like

Assuming the css etc are held in external files, the next time this happens, try renaming your references to the external files.

So instead of:

<link rel="stylesheet" href="assets/css/custom.css">
<script src="assets/js/custom.js"></script>

Try:

<link rel="stylesheet" href="assets/css/custom.css?ver=1234">
<script src="assets/js/custom.js?ver=1234"></script>

You don’t need to change the actual names of the files themselves.

If that works, then it’s likely you’ve just been seeing a browser-cached version of the files.

Every time you change the number from 1234 to 1235 and so on, the browser will be forced to reload those files.

I usually take this a step further and create a System Setting variable:

<link rel="stylesheet" href="assets/css/custom.css?ver=[[++version]]">
<script src="assets/js/custom.js?ver=[[++version]]"></script>

That means just changing the number in the System Setting will force all your files to be reloaded on the users’ browsers.

1 Like

If the problem is the cache of the browser, then maybe just use Shift + F5 to reload the page in the browser. This should ignore the cached content.

Absolutely @halftrainedharry - although that will only solve the problem for the user doing the refreshing. Changing the filenames forces all users’ browsers to grab the updated files.

I don’t think Ctrl-F5 reliably clears everything. I use a Chrome extension, Classic Cache Killer 2.2, that takes the browser cache completely out of the picture.

I also sometimes use the CacheClear extra to fully clear the MODX cache during development. I try to only use it late at night so there are fewer users to inconvenience with the slower page loads.

Some DNS providers, like Cloudflare, will cache your files too. Cloudflare’s dashboard has a “development mode” option that will disable caching for three hours.

It’s a strange one. I’ve never had this issue before. Usually when I do a change to CSS, press Shift + F5 together, I see it instantly but with this site, even when I physically clear the cache, it takes an age for the changes to come through.

Thanks a million for your help to date

I’ve had this happen a couple of times when the hosting company had updated the server software, and a server-native caching program was installed. Once I found where those were and turned them off, updates on the site became instant again.

Browser updates can affect this too, though, especially Chrome I’ve found. Make sure when you Shift-F5 you check off “Application Cache” or “Offline Website Data” or “Hosted App Data” (depending on your browser).

Are you using Cloudflare or some other CDN? For sites that use Cloudflare, I install a little plugin in MODX to clear the Cloudflare cache.

1 Like