Welcome!

And don't forget to edit your signature & profile.

 

Icon

Statistics

  • Total posts 27014
  • Total topics 4908
  • Total members 6646
  • Our newest member
    trickell

TOP POSTERS

Refreshing after changes

Designing the web. Work and development.
   

Refreshing after changes

Postby techcastoni » Tue Apr 14, 2009 1:59 pm

Hi SmashingMag readers.

I've been living with a problem of caching on my web browser and although it's a minor annoyance, fixing it would save me a huge amount of time.

A scenario includes making a change to my CSS or any of my PHP files that results in a cosmetic change (e.g. changing the colour of my P tags or the insertion of new text/content).

On saving the file with the new changes, even after waiting several seconds after the save has completed, when I refresh my browser, the changes don't appear. I have to refresh a second time for it to appear. I know you can do a full refresh, but that takes longer.

Strangely, this doesn't happen on my work machine and I'm using the latest versions of Firefox on both machines. Is this a server thing or is it a setting somewhere on my browser that requires a hack?

Searched around Google and although I can find many people with the same problem, I can't find a solution.

Do any of you out there have a solution?
techcastoni
Smashing <table>
 
Posts: 30
Joined: Tue Apr 07, 2009 9:49 pm
Location: UK
   

   

Re: Refreshing after changes

Postby Andy » Tue Apr 14, 2009 2:04 pm

Tools > Clear Private Data...

Tick "Cache" and click "Clear Private Data Now"

OR

CTRL + F5
Andy
Smashing <h5>
 
Posts: 1305
Joined: Tue Sep 30, 2008 6:42 pm
Location: Sweden
   

   

Re: Refreshing after changes

Postby techcastoni » Tue Apr 14, 2009 2:06 pm

Andy wrote:Tools > Clear Private Data...

Tick "Cache" and click "Clear Private Data Now"


Doing that would be even slower than refreshing twice. I think you mis-understood the problem.

The problem isn't that I don't know how to clear my cache or do a full refresh (holding shift).

The problem is that changes don't appear when I do a standard refresh unless I refresh twice.
techcastoni
Smashing <table>
 
Posts: 30
Joined: Tue Apr 07, 2009 9:49 pm
Location: UK
   

   

Re: Refreshing after changes

Postby Andy » Tue Apr 14, 2009 2:36 pm

techcastoni wrote:Doing that would be even slower than refreshing twice. I think you mis-understood the problem.

The problem isn't that I don't know how to clear my cache or do a full refresh (holding shift).

The problem is that changes don't appear when I do a standard refresh unless I refresh twice.



....... because of cache. Usually this is defined in the headers sent back from the server. But it might also be a browser setting.
Check your apache settings (assuming you use apache). Cache might also be manipulated by a server-side script.
Andy
Smashing <h5>
 
Posts: 1305
Joined: Tue Sep 30, 2008 6:42 pm
Location: Sweden
   

   

Re: Refreshing after changes

Postby Ryan Williams » Tue Apr 14, 2009 2:41 pm

There's a lot of variance in the type of caching web servers command, so if you're using a different server to the one(s) you might use at work then that's probably your problem right there.
Do you like Monkey Island? What about Day of the Tentacle, Full Throttle, Grim Fandango, or Psychonauts? These games all have one thing in common: Tim Schafer. To check out his latest game, head over to BRUTAL! The Legendary Fan Site.
User avatar
Ryan Williams
Smashing <div>
 
Posts: 236
Joined: Tue Feb 10, 2009 11:29 am
Location: Notts, UK
   

   

Re: Refreshing after changes

Postby Fruityger » Tue Apr 14, 2009 3:16 pm

If you have access to .htaccess you could turn cache off for all files. This is not always the correct thing to do. I think you can target only .css and .php files.

You can also turn cache off in php.ini or even inside the .php script. Sometimes handy too when IE6 keeps caching ajax requests.

Use a pragma no cache-header or set Cache-Control to no-cache. Unfortunately, I can't give u a universal piece of code for that, that will work safely with every server setting or doctype, but see how far this takes you.

Code: Select all
<?PHP
  header('Pragma: no-cache');
  header("Expires: Mon, 26 Jul 1990 05:00:00 GMT");
  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  header("Cache-Control: no-store, no-cache, must-revalidate");
  header("Cache-Control: post-check=0, pre-check=0", false);
?>
User avatar
Fruityger
Smashing <div>
 
Posts: 155
Joined: Sun Apr 05, 2009 8:22 pm
   

   

Re: Refreshing after changes

Postby conanite » Tue Apr 14, 2009 5:44 pm

The FF "WebDeveloper" add-on has a "disable cache" option which is fantastic for development and for the problem you describe ... you just need to remember to undisable the cache when you browse elsewhere, or the internet will appear to be on strike :)
User avatar
conanite
Smashing <table>
 
Posts: 24
Joined: Mon Mar 23, 2009 6:31 am
Location: Paris, France
   


Return to Web Design



Who is online

Users browsing this forum: No registered users and 1 guest