Details determine success or failure! The meaning of browser caching is to improve the execution efficiency, but it also brought some problems, resulting in the service side modified JS, CSS, the client can not update
method to generate a random number
Copy Code code as follows:
<script type= "Text/javascript" src= "/js/test.js?+math.random ()" ></script>
Disadvantage, the browser cache loses its meaning, dynamically loading each time.
Method Two version number control, set the global variable, each release before the version number plus 1
Copy Code code as follows:
<script type= "Text/javascript" src= "/js/test.js?v=<%=v%>" ></script>
This practice is recommended in a relatively simple way. The disadvantage is that the HTML page is not available, but this page should not be too much
More methods: The use of reading file size, file modification time to generate MD5 automated implementation, automatic construction of the program compression merge JS and the global replacement version, the way is complex, interested can study
Who else has a better way?