Sometimes you may encounter JS or CSS file references after passing parameters:
CSS and JS with parameters (shaped like. css?v= and. js?v=)
<script type= "Text/javascript" src= "jb51.js?version=1.2.6″></script>
<link rel= ' stylesheet ' href= "http://www.php1.cn/" >
There are two possible ways to use parameters:
First, the script does not exist, but the server is dynamically generated, so with a version number, to show the difference. That is, the above code is equivalent to the file <script type= "Text/javascript" src= "jb51.js" ></script> <link rel= ' stylesheet ' href= " http://www.php1.cn/">
Second, the client will cache these CSS or JS files, so each time you upgrade the JS or CSS files, change the version number, the client browser will re-download the new JS or CSS files, the role of the brush cache. We may sometimes find that the change of style or JS, the time of the refresh is not changed, that is, the client cache css or JS files, so plus the parameters are good!
The second situation is the most, and it is possible that both exist simultaneously.
The version number can be a random number, or it can be an incremented value, a large version of the iteration, or according to the script's generation time, such as 20080727182553 is accurate to generate script seconds, and 2.3.3 is a large version of the way the small version.
First-time Upgrade:
<script src= "aaa.js?v=1.0" ></script>
Second Upgrade:
<script src= "aaa.js?v=1.1" ></script>
Third-time Upgrade:
<script src= "aaa.js?v=1.2" ></script>
......
Where "V" is just a name, take it casually. This workaround is similar to the principle of adding random numbers after the AJAX request address, allowing the browser to think of accessing different addresses so that cached files are not used.
For example, Sina homepage in the April 5, 2010 revision, just change the CSS style sheet, can be behind the CSS, such as. css?2010.4.5, so that users do not clean the cache to open the Sina home page will not be the same as before, When the server reads the CSS file, it re-reads the latest 2010.4.5,