Jump to content

dsonesuk Prompts Question About Cache Clearing Solved with thanks in final post


niche

Recommended Posts

dsonesuk, made a very coincidental statement about cache clearing today in the JS forum and I didn't want to hyjack the topic with this question. Just this morning I made a web based dynamic presentation and I had to ask the user to clear her cache. She was using FF. The presentation wasn't working correctly before she cleared her cache (data wasn't refreshing correctly) and all was well after the clear. If I didn't have a lot of experience with FF, I would still be cleaning egg off my face. What's going on with the cache?

Edited by niche
  • Like 3
Link to comment
Share on other sites

What do you mean what's going on with it? The browser will cache any resources it can so that it doesn't need to load them a second time from the server. Headers from the server will tell the browser if or how it should cache a particular resource.

Link to comment
Share on other sites

I've noticed that when I get unexpected results in FF and I don't have an explanation, clearing the cache can can fix my problem. It happened that way this morning, and dsonesuk's post in http://w3schools.inv...showtopic=43836 was too coincidental to ignore. I'm not suggesting clearing the cache is a cure-all. I am saying that it can solve problems when I don't have any other explanation. There seems to be a connection. I just don't know what it is or might be. I also must say that this kind of experience is limited to FF. It's the browser I use most of the time because of Firebug. Anyway, it just thought someone might know something about this phenomenon given dsonesuk's post.

Edited by niche
Link to comment
Share on other sites

I'm not sure what you're confused about. A browser will typically download and cache something like a Javascript file. If you update that file the browser might not know it, it might still be using the cached version. Eventually it will download the new one on its own. Like I said, you can use headers for things like Javascript files or images to have the server tell the browser how or if it should cache it (and for how long), and you can use meta tags in addition to headers for cache control on HTML pages. One of the options is that you can tell the browser how long to cache something for before it looks for a new version. You can also change browser settings relating to cache use. If people have a site where Javascript files get updated frequently then they may include a version number in the filename, so that the browser sees a new filename and will download it instead of using the old version in cache.

Link to comment
Share on other sites

I have to admit that I too am often taken by surprise sometimes with the cache in FF. Especially when it comes to PHP. I would say that 98% of the time, changes I make in PHP are immediate and do not require any steps other than hitting refresh. The other 2% require that I clear the cache. Perhaps it is some header or something in certain files (as I tend to work on a great number of different files pertaining to various reports and such). Though, sometimes it seems that only certain changes are not taking effect. Where one change comes through but something else doesn't and when I clear the cache everything works as expected.

  • Like 1
Link to comment
Share on other sites

Well put ShadowMage. It's that 2% I'm taking about.

Link to comment
Share on other sites

Guest So Called

I too use FF (because IMO it's the best browser) and I've been annoyed by pages that sometimes "stick" and need me to clear the cache. I think (but I'm not sure) that ctrl-F5 will force a page access instead of a cache refresh. Also, I've set my site so that when I'm logged in as admin (have the admin cookie) that the site adds these two headers. I'm not sure if it helps.

header('Cache-Control: no-cache');header('Pragma: no-cache');

  • Like 1
Link to comment
Share on other sites

Thanks for everyone's help including the folks that read this topic. I'm especially thankful to justsomeguy, ShadowMAge, and So Called.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...