0

So, I'm running an apache server on linux. Sometimes, Firefox decides to not load the new version of a file after I edited it. For example, right now I have a .js file wich is loaded dynamicly. It had a bug, wich I corrected (I checked with Chromium), but when the file is loaded in Firefox, it still has the bug! When looking at the response header of the ajax request, I see the code of the file BEFORE it was changed. But that code doesn't exist anymore... I had this happen with CSS files too.

When I rename the file to something else, it loads the right stuff, but as soon as I rename it to the old name, it starts loading an old version of the file again!

  • I restarted apache2, but that didn't change anything.
  • I checked for file permissions too, no problem there as far as I could tell (I changed all files' permissions to rwxrwxrwx to be sure).
  • When accessing with an other browser, it works fine!

In previous cases, the next day or so, the problem would have vanished, but I can't always just stop for a day in what I'm doing...

Alex
  • 1,157
  • 3
  • 11
  • 25

1 Answers1

2

This is caused by browser cache,
you can consider to use url with version parameter,
like http://yourdomain.com/js/some.js?v=$version,
and update the $version whenever you update a css/js

ajreal
  • 46,720
  • 11
  • 89
  • 119
  • Browser cache... how come I didn't think of that... Different browsers acting differently should have hinted it to me. Thanks anyway! – Alex Feb 02 '12 at 18:59