I have a WAMP server with PHP 7.2.10. When I change a file, for example .css, the changes is not visible in browser. When I "view source" via my browser (Ctrl+U) I get the updated latest version of the code. Even then, the browser doesn't display update the appearance of my site.

I was thinking that if it were just a caching problem, the old version of file should be show in "view source", shouldn't it?

I have the same problem with JavaScript. I have simple jQuery code (alert after clicking the selected class), it is visible in source code of site inside browser, but when I click the selected class, nothing happens.

  • The only thing you need to do is ctrl+F5. This is a cache refresh. – Efrain Alvarez Mar 18 '19 at 18:59

I was thinking that if it were just a caching problem, the old version of file should be show in "view source", shouldn't it?

View Source will actually show you the new version of the file, not the old version. Chrome and Firefox both refresh the resource when you View Source, which means you would see the new version.

To ensure you always get the fresh version, you can do one of two things:

  • Check your Cache-Control HTTP header and make sure your server is serving a response such as no-cache


  • Open up the dev tools of your browser, go to the Network section and click "Disable Cache" to disable caching while dev tools is open
| improve this answer | |

I found that if you call up the specific document (localhost/example/cssfile.css) in yuor browser, then "refresh" it, the document changes will update and take effect. Not sure if this is a Window's glitch, or a WAMP glitch. But that has consistantly resolved the problem for me.

| improve this answer | |
  • I don't think this is a glitch, just a caching issue, but I could be wrong. The reason this refreshing trick works is that the refresh button instructs the browser to fetch a fresh version of the resource, rather than relying on the standard caching behavior. Then once the browser has the new version loaded, it will use it when other pages request the same resource. – Maximillian Laumeister Dec 16 '18 at 22:38
  • I was having the problem while I was doing quick edits to my file. Change, test, change, test... but because this edits were within seconds of eachother, normal caching still thought it had a 'new' version. I could see the old one in the browser, hit refresh, and ta-da! the new doc would load. – elbrant Dec 16 '18 at 22:44
  • Have you considered serving your dev environment using Cache-Control: no-cache headers? Might save some time over fiddling with the refresh button. – Maximillian Laumeister Dec 16 '18 at 22:52
  • I don't use dev tools, I code everything old school with TextPad (similar to NotePad). I will try the view source trick though (fewer steps). Thanks. :) – elbrant Dec 16 '18 at 23:00
  • To clarify, when I say "dev environment" I don't mean your editor, I mean your local HTTP/backend server setup that you use for development. – Maximillian Laumeister Dec 16 '18 at 23:07

Also, if you are using PHP, you can put this code:

"?v=<?php echo time(); ?>"

in case of the link tag, at the final of the href param like this example:

"<link rel='stylesheet' href='./inc/mystyle.css?v=<?php echo time(); ?>'>"

that will result in your code something like this:

"<link rel='stylesheet' href='./inc/mystyle.css?v=1553116856>"

that will do a cache refresh always;

in case of a script tag is the same thing but in the src param like this:

<script src="./inc/myscript.js?v=<?php echo time(); ?>"></script>

and will result in the same way:

<script src="./inc/myscript.js?v=1553116856"></script>

Try it! I espect that this help you!

| improve this answer | |
  • This looked like an elegant solution and at first didn't work, at least on my test platform. Chrome browser Version 76.0.3809.132 (Official Build) (64-bit), localhost XAMPP control version v3.2.4 XAMPP Version: 7.3.6 But I was wrong, this seems to work with some waiting time. <script src="js/ovEndDate.js?nocache=<?php echo time(); ?>"></script> – user104924 Sep 26 '19 at 2:58
  • If you clean the cache of your browser or run it on an incognito window will work perfectly! – Efrain Alvarez Sep 27 '19 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.