Here's an easy but useful tip!
Have you ever had to say (or been told):
"You might have to refresh the page(s) to see the changes."?
Creating websites for people I found myself saying this quite a lot. Some people then need an explanation of how to refresh a page!
If a website has changing content - like latest news or listings etc. then visitors that have viewed the page before have a good chance of having the data cached (stored locally on their device by the browser) so won't see the latest changes.
A client eventually said to me that regular website visitors might not be seeing the latest changes. A good point! Depending on the visitors browser settings they could well be viewing out of date content.
I started looking at the options to fix this. I found many references to adding META tags.
<meta http-equiv="pragma" content="no-cache">
But after some experimenting I found that not all browsers obey these tags so it wasn't a reliable solution.
The answer is to update your .htacess file to include a few simple lines. This is what I use:
<FilesMatch "\.(htm|html)$"> ExpiresActive On ExpiresDefault A300 Header append Cache-Control must-revalidate </FilesMatch>
Caching is a good thing on the whole as it speeds up your web site for your visitors - using the above code keeps images (a big bandwidth overhead) cached as normal. But all files ending in htm & html are only cached for 5 minutes (A300 = 300 seconds after Access).
This seems a good compromise. The website is quick to browse but repeat visitors will be forced to load the new content.
Did you find this article helpful?