CSS and JS with parameters (such as. css?v= and. js?v=)
Copy Code code as follows:
<script type= "Text/javascript" src= "jb51.js?version=1.2.6″></script>
<link rel= ' stylesheet ' href= ' base.css?version=2.3.3′type= ' text/css '
There are two possible uses of parameters,
The first, the script does not exist, but the server side dynamically generated, so with a version number, to show the difference. That is, the code above is equivalent to a file
Copy Code code as follows:
<script type= "Text/javascript" src= "Jb51.js" ></script>
<link rel= ' stylesheet ' href= ' base.css ' type= ' text/css '
But the browser will think he is a version of the file!
Second, the client will cache these CSS or JS files, so each time you upgrade the JS or CSS file, change the version number, the client browser will download the new JS or CSS files, brush the role of caching. We may sometimes find that the modified style or JS, refresh the same time, that is, the client cache css or JS files, so add parameters are still good!
The second is the most, and there may be two of them at the same time.
The version number, can be a random number, or it can be an incremented value, a large version of the version of the way, or according to the script generation time to write, such as 20080727182553 is accurate to generate the script of the second, and 2.3.3 is a large version of the small version of the way