User see current version of Jquery and CSS without cache

Asked

Viewed 56 times

3

Every time I update the CSS and JQUERY from a website, I need to keep asking the customer to open the site in an anonymous window. Because his browser saves the old files and he can’t see the changes.

What’s the best way around it?

  • I believe that if PHP is used this answer should be for your case https://answall.com/a/117510/3635

1 answer

1


I will make a summary of all possible ways and give you a hint, use at the end of import a random number. I use a java application and will leave an example:

<script type='text/javascript' src='${homePath}/script/jQuery/jquery-ui.js?v=${random.nextInt()}'></script>
  • What is this ${homePath} and ${random.nextInt()}? I think randomly a bad idea, because you lose the main advantage, the http cache, which makes the site slower to load for users, even more if you are on a mobile internet. The ideal for the author or for anyone would be perhaps something "equivalent" to a checksum or adapt this answer https://answall.com/a/117510/3635 to this template system that you applied.

  • The idea of using the random number is to avoid the "CACHE" as the author of the question wants, whether or not to delay loading the page I think the consequence is his. I think the question was clear enough

  • Exactly what the link I indicated to you will do, it also avoids caching, but avoids when necessary, "when updates occur" actually in . css or . js.

  • 1

    I understood, is that at the moment I am unable to look your recommendation more will see soon, thanks for the tip @Guilhermenascimentop.

Browser other questions tagged

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