(please specify the website or account you are asking about)
So basically i have a separate css file called “home-2020.css” in a different folder. I linked the html with that css. However, although the html was able to get the css, the css file is old even tho i updated it. The only way this fixes is if i refresh the css file url tab 2 times OR clear my cache. This is a BIG no no! Comparing it towards another host (aka 000webhost) they don’t experience this problem. This problem seems to be coming from infinityfree!
So in general, how do i fix the site so it only reads the latest css file and the old one? Without keep clearing my cache or refreshing the page twice.
(please share the FULL error message you see)
(other information and details relevant to your question)
You don’t need the tag, you only need to setup cache headers. Cache headers will allow you to control how long browsers hold copies of your website for.
Other hosting providers may not require these headers to be set because their servers may be configured differently. The alternative is to just set the cache headers today, then totally forget about them because you won’t have to do it again (Unless you want to change the cache timeout).
Of course, because the browser cached v=30. That is why you must update it as you make changes. A good way to make sure this does not happen is to use the milliseconds date (which will never be the same twice). At the time of posting this, it is 1647565590135 and is now 1647565625406. See, within 5 seconds, it has changed drastically.
We configured our servers to enable browser caching by default. That’s because leveraging browser caching is often a very good idea: it saves bandwidth for both your site and the visitor, it reduces server load and speeds up your website.
The only downside is that changes to your code are not visible immediately. But most code gets accessed a lot more often that it gets changed, so caching is almost always worth it.
You don’t need this tag for your site to work. Your site will work better without it. So before disabling cache, please think long and hard whether you really, absolutely need it, and are willing to accept the consequences.