I've been having a crazy annoying problem for a few weeks that I can't seem to solve. Occasionally when I update the Javascript or CSS files for my site hosted on Siteground, Chrome will refuse to recognize them. Other browsers will pull the new files immediately if I empty the cache and refresh, Chrome will not.
I have:
- Verified through cPanel file manager that the correct files are uploaded to my server.
- Repeatedly emptied Chrome's cache.
- Repeatedly used devtools "hard reload" and "empty cache and hard reload".
- Repeatedly quit and reopened Chrome.
- Completely turned off Chrome's cache through devtools.
Maddeningly enough, the problem seems to solve itself when I e back to it a few hours later. What am I missing here that is keeping Chrome from reading the new files?
I've been having a crazy annoying problem for a few weeks that I can't seem to solve. Occasionally when I update the Javascript or CSS files for my site hosted on Siteground, Chrome will refuse to recognize them. Other browsers will pull the new files immediately if I empty the cache and refresh, Chrome will not.
I have:
- Verified through cPanel file manager that the correct files are uploaded to my server.
- Repeatedly emptied Chrome's cache.
- Repeatedly used devtools "hard reload" and "empty cache and hard reload".
- Repeatedly quit and reopened Chrome.
- Completely turned off Chrome's cache through devtools.
Maddeningly enough, the problem seems to solve itself when I e back to it a few hours later. What am I missing here that is keeping Chrome from reading the new files?
Share Improve this question edited Feb 12, 2017 at 22:07 Dylan Stark asked Feb 12, 2017 at 21:58 Dylan StarkDylan Stark 2,39519 silver badges24 bronze badges 5- 2 Check with incognito mode if the problem still occurs. – kind user Commented Feb 12, 2017 at 22:00
- 1 @Kinduser just checked, still using the old files. – Dylan Stark Commented Feb 12, 2017 at 22:03
- 2 That's definitely a caching issue. Have you tried disabling Chrome's cache through the Network tab in DevTools? – Obsidian Age Commented Feb 12, 2017 at 22:03
- 1 @ObsidianAge just tried that as well, still pulling old files. I have pletely emptied the Chrome cache many, many times now yet it still won't update the files. – Dylan Stark Commented Feb 12, 2017 at 22:06
-
If you have access to PHP, you can append the current timestamp to the version of the file, causing it to override the cache each time it is loaded --
href="style.css?v=<?php echo time(); ?>"
– Obsidian Age Commented Feb 12, 2017 at 22:13
3 Answers
Reset to default 9Had this problem as well, going into developer tools solved the problem.
- open developer tools
- click on the network tab
- check the disable cache option, then uncheck it.
after doing this it then used the current version of my javascript file.
Sometimes the server itself is caching the responses for certain user agents (which distinguish what kind of browser you're using to the server), which may explain your issue.
I suggest trying to change your UA (user agent) through devtools to what you currently have in firefox/safari for example to see if the problem persists.
That's just one of the ways that the server may cache responses for certain browsers, as it may also change from other small implementation differences.
Check through your server's settings to see if something is being server-cached, or if the server is adding additional caching information through localStorage
and similar, and then try to change those settings or the pieces of code that rely on client storages that aren't considered cache.
It wasn't the server (view-source showed current file) and no mand or browser option I've found anywhere worked (including prior answers here).
What finally worked: create a new browser tab and debug from there.