Home > Software design >  How to disable CSS caching in development, working with a PHP back end?
How to disable CSS caching in development, working with a PHP back end?

Time:05-27

I'm working on php/css project through localhost and nearly every time I change css and reload page, css remains unchenged until I delete cookies, cache and other site data (somethimes even then it doesn't work straight away). Css is linked correctly, as well as aeverything else, so this is not a problem with code, but with browser/cache.

My question is- is there a way to resolve this issue other than deleting cookies and cache every time I change something in my css?

CodePudding user response:

Please add a query parameter to CSS with dynamic file modified time:

<link rel="stylesheet" href="style.css?v=<?php echo filemtime("style.css");?>" />

CodePudding user response:

All the comments and answers were helpful, but none of them solved the problem long term.

After some experimenting, I found an answer: disable saving cookies and cache for given site, in

chrome settings > advanced > Privacy and security > Sites that can never use cookies

  • Related