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. Commented Mar 18, 2019 at 18:59

3 Answers 3


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

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.

  • 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. Commented Dec 16, 2018 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
    Commented Dec 16, 2018 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. Commented Dec 16, 2018 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
    Commented Dec 16, 2018 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. Commented Dec 16, 2018 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!

  • 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
    Commented Sep 26, 2019 at 2:58
  • If you clean the cache of your browser or run it on an incognito window will work perfectly! Commented Sep 27, 2019 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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