Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browsers using old CSS stylesheets?

I'm having a problem with a site that I just made live - I had to correct some CSS issues related to the background and some image placements. Everything of course looks great in VS Code. I open it in Chrome and Firefox and they look completely different - and wrong. Developer tools showed they were using the old CSS stylesheet (which was originally loaded, then replaced). If I open an incognito window, all is perfect. Any reason this would be? I'm new to this (changing careers) so I appreciate your insight!

like image 649
erlawrence Avatar asked Feb 27 '26 12:02

erlawrence


1 Answers

This is most probably because the css file is cached in your browser. To fix this problem, you can use cache buster in the URL. For ex, your CSS URL is

https://www.abc.xyz/static/css/core.css

So, whenever you make changes in the CSS file, change the URL to this

https://www.abc.xyz/static/css/core.css?version=1.0.1

?version=1.0.1 changes the file URL and hence it is not loaded from cache. Just change the version number when you make the changes to the file so the URL is new again

like image 121
Ashish Prakash Avatar answered Mar 01 '26 05:03

Ashish Prakash



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!