Browser cache is confusing

Yesterday, I was working on a website and had two versions of the same file. When I was ready to put the new version up for testing, I deleted the old one and put in the new one. I refreshed my browser window. No change! I pressed Ctrl+F5. I was still seeing the old version! I replaced the old file again, making sure to overwrite the old copy. I refreshed a few times and used Ctrl+F5 a few times to “force refresh.” No go. For about 5 minutes I was totally confounded. Why was the old version of my file still showing up, no matter how much I tried to refresh?! As a last resort, I went to Tools -> Clear Private Data in Firefox, and cleared my cache. One last refresh, and– BAM! The beautiful new version finally appeared. Another example from today after the fold…

Today I worked on moving a website from one server to another. This meant there’ll be some time while we wait for the new nameserver settings to propagate. In the meanwhile, I’ll use my hosts file, which is awkwardly located at  c:\windows\system32\drivers\etc\ in Windows XP Home. I set everything up, and then… WordPress was saying it was at version 2.1.3. I thought I had the 2.2.1 files up there. Am I looking at the right server? I used ping at the command line to verify what my computer thinks is the domain’s IP. Looks good. Refresh. Still the old version. Let’s run the upgrade.php script. I did that, and no change. Tried everything a few more times. For about 10 minutes, I was totally confused. Why am I still seeing the old version number?

Did WordPress change something about their upgrade process? I went to WordPress.org and read the upgrade documentation. Nope, looks fine. Ran the script again. No go. I renamed files. What the–? The site still loads as if nothing happened! And the files are clearly not there anymore. This is weird, I thought. But Ctrl+F5 cleared it up. It seems that my browser cache was the problem the whole time. Finally going to the admin panel forced me to do some updates to the db, and the upgrade script ran successfully. So now we’re on the latest version of WordPress, 2.2.1.

What a complex ordeal just because of weird browser caching issues. I thought web browsers were supposed to hit the web server to get a ‘last-updated’ header or something which should tell them if they yet know the latest version. Someone has got to improve this process.

2 Responses to “Browser cache is confusing”

  1. Haochi says:

    Sometimes Clear Private Data could be annoying (you have log into multiple accounts again), I usually prefer to use the Clear Cache feature in Firefox under Preference->Advance->Network->Cache.

    Well, the Clear Cache plugin might work just well.

  2. ZACK says:

    I have found exactly the same bug. It seems to be two parts to it, one is the firefox cache gets confused (i keep getting the wrong images) and the second error seems to be that firefox doesnt clear the cache properly. If anyone knows a fix for getting the cache to clear properly I would be glad to hear of it!

Leave a Reply