0

I'm developing a web application with Spring MVC & Hibernate and I deploy it in Apache Tomcat 8.

My users use Google Chrome to use my app normally but when I make a change in the CSS or JavaScript and I redeploy the changes into tomcat the users don't see the changes in their browser!

So I have to manually clean the cache in the Chrome.

How can I disable cache so I can make changes and my users see them instantly ?

2

2 Answers 2

2

You can just add a deploy version to your css file so this will reset cache from version to version. E.g. stylesheet.css?v=2.1.1.

Sign up to request clarification or add additional context in comments.

Comments

1

You should try adding a version number or maybe a timestamp date change on the scripts / link rels of your css / js like so:

<head>

   <script type="text/javascript" src="js/file.js?#version_number"></script>
   <link rel ="stylesheet" href="css/file.css?#version_number" />

</head>
  • where version number is should be replaced by server side code

this forces the browser to reload the scripts each time, instead of using the stored cache version of the script / stylesheet

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.