Clear my user cache?

Asked

Viewed 535 times

0

I took a virtual store to do some updates, and so far so good. I did, etc...

The problem is this. CSS modifications only apply in the clients' browser if they clear their browser history. If for example, they entered the site a week before, and today, after the update I did, they enter again, the site will still get that CSS information the last time his site "downloaded my site".

Since the store is Magento, it has the options to clear cache, and it also has the part to clear CDN cache, but it’s no use.

Is there anything in PHP or Javascript that makes it erase this data from the client’s browser?

  • 2

    With PHP it’s impossible. I don’t know if there’s anything in JS to do something like this. Anyway, the best idea is to "Versionar" the CSS file and always use a different name in it, this will make the browser be required to download it.

  • I liked this solution, of Versionar, thank you LINQ!

  • 1

    No need to rename the file, just pass a querystring to it, for example script.js?v=123.

  • As the friend @bfavaretto said, you can also add a dynamic querystring always updated with echo: meu_css.css?<?php echo date("ymdHis"); ?>, with year, month, day, hour, minute and seconds.

  • There is no way a code via HTML can do this kind of intervention on the client’s machine. Either you create mechanisms to "cheat" the browser (like the suggestions in the other comments) or ask the user to access the browser settings and clear the cache (not recommended).

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.