How to prevent browsers from caching blog pages?
-
Hi all,
I found out there’s a problem with the Chrome browser (maybe other browsers as well) reloading old versions of my blog pages from their local cache – instead of loading the latest, updated version from the WordPress server.
Here’s how I found out there’s a real problem. In my sidebar (theme is customized K2-lite) I have an item that’s updated daily: “Today in History”. It shows events from the past. So today, Nov 12, it shows an event from Nov 12 in the past (Nov 12 1935, first leucotomy). Tomorrow, Nov 13, it will show an event from a Nov 13 in the past.
Now a friend asked me why I sometimes kept showing yesterday’s items instead of updating them, after all, the title is TODAY in History?
Turned out she was using Chrome, and her browser kept reloading yesterday’s page from its cache instead of loading today’s updated one. I next found out that keyboard shortcut Ctrl-F5 forced Chrome to load the new data correctly – but how many users will know (and do) that?
So my question is, how do I force any browser to NOT cache my blog pages? I looked up the HTML code for this, it is
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
But it looks like this must be inserted above the<html>page header. How do I do that?
As usual, any help will be highly appreciated!
Thanks, HenkThe blog I need help with is: (visible only to logged in users)
-
You have a WordPress.COM blog and you can’t change code here – security and reliability reasons
You can encourage your friends to subscribe to your blog so they know when a new Post is up – then train them to refresh their browser when visiting –
Sorry don’t know enough about browsers to know if there is a setting you can change at the browser level to stop caching – caching is done to speed up load time and save bandwidth
-
@auxclass: thanks for reacting! Unfortunately this doesn’t help me.
My “Today in History” items are not regular posts, but daily refreshed items in the blog’s sidebar. So they’re not announced to subscribers (which would be a pita to them anyway, because if they were announced, then they would get a mail about this every day…)
As for “training” my blog visitors to press refresh keys every time they visit my blog, I think that’s no solution at all. It would entail putting up messages on every blog page, like “Dear Visitor, if you use browser X then before reading this page first press key combo A+B, if you use browser Y then press …. ” etc. etc.
So this suggestion just illustrates that a solution really needs to be found within the WordPress page code itself!
I hope some WordPress support person will understand this and come up with a solution soon. -
A week later, and this issue is still not resolved. I managed to establish for sure it is the Google Chrome browser that has this problem — it keeps pulling old data from its cache instead of loading the new data from the WordPress server. IE, Firefox, and Opera don’t have the same problem (I checked all four browsers’ behavior myself).
Could someone from the WordPress staff please tell me if there is a way to solve this problem, by preventing the browser to re-use its cache? Or some other workable solution? -
Another week, and still looking for some kind of solution. No help at all from WordPress people, so far.
More tips or ideas to solve this problem, anyone?
- The topic ‘How to prevent browsers from caching blog pages?’ is closed to new replies.