Search code examples
javascriptcssgoogle-chromegithubxampp

XAMPP won't update web source files until they're committed to Git on Chrome


I'm trying to create a web application for university. I've been doing fine with XAMPP, using Visual Studio Code and Sublime Text as my editors and so far so good. However, a couple of days ago, I ran into what seemed to be a bug.

While accessing "localhost" on Chrome, the website didn't seem to reflect the last changes to the HTML and CSS code. I also modified some Javascript and it didn't work either, the website stayed the same. Not even simple things like changing a colour on CSS or adding an alert window on Javascript would appear on the actual web.

Inspecting the website in Chrome shows the old documents and source code, however, when going to the "htdocs" folder at XAMPP, the documents were successfully changed, and no matter what I did, relaunching XAMPP or Chrome didn't fix it either. I decided to give up for the day and committed the changes to my GitHub repository. To my surprise, I refreshed the website afterwards and it worked. I thought it was an isolated bug, but it seems like it is not, it happened today again while working on a completely different project. What's more surprising, this behaviour doesn't seem to happen on Firefox or even Safari, I've tried both and it seems to be fine. However, I prefer the tools included in Chrome, so I'd rather use this one.

Has anyone else had the same issue? If so, how did you fix it? Or in case it is intended to work like that, why is it? I don't see any possible scenario where this could be useful.

Thank you in advance.


Solution

  • This is more of a workaround than a solution really, but you could just try ctrl+F5, this will clear your cache and you're good to go again.

    This is probably the single worst Chrome bug when you're doing incremental small changes but Chrome loads it from the cache and not the original files.

    What does Ctrl+F5 do?

    This ignores the page saved in the cache and does a fresh GET. This should serve well enough as any changes made will be reflected in Chrome on doing so. Or you can manually clear the cache from the Chrome settings.