Home  >  Q&A  >  body text

How to disable CSS caching in development using a PHP backend?

I'm working on a php/css project via localhost and almost every time I change the css and reload the page, the css remains the same until I delete cookies, cache and other site data (sometimes even then it doesn't work immediately Work) . The CSS and everything else links correctly, so it's not a code issue but a browser/cache issue.

My question is - is there any other way to fix this besides deleting cookies and cache every time something in the css is changed?

P粉536532781P粉536532781178 days ago313

reply all(2)I'll reply

  • P粉590929392

    P粉5909293922024-03-29 22:16:14

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

    " />

    reply
    0
  • P粉520545753

    P粉5205457532024-03-29 09:54:55

    All comments and answers are helpful, but none of them solve the problem in the long term.

    After some experiments, I found the answer: disable saving cookies and caching for a given site

    Chrome Settings > Advanced > Privacy & Security > Sites that can never use cookies

    reply
    0
  • Cancelreply