Why add parameters to the introduced css or js file?

Source: Internet
Author: User

CSS and JS tape (.css? V = with. js? V =)
Copy codeThe Code is as follows:
<Script type = "text/javascript" src = "jb51.js? Version = 1.2.6 "> </script>
<Link rel = 'stylesheet 'hrefw.'base.css? Version = 2.3.3 'Type = 'text/css '/>

There are two possibilities for using parameters,

First, the script does not exist, but is dynamically generated by the server. Therefore, a version number is provided to indicate the difference. That is, the above Code is equivalent
Copy codeThe Code is as follows:
<Script type = "text/javascript" src = "jb51.js"> </script>
<Link rel = 'stylesheet 'href}'base.css 'type = 'text/css'/>

But the browser will think it is a version of this file!

2. The client caches these css or js files. Therefore, after each js or css file is upgraded, the client browser will re-download the new js or css file by changing the version number, the role of the cache. Sometimes you may find that you have modified the style or js, And the refresh time remains the same, that is, the client caches css or js files, so adding parameters is good!
The second case is the most, or both.

The version number can be a random number, an incremental value, a large version or a small version, or a script is written based on the script generation time. For example, 20080727182553 is accurate to the second when the script is generated, 2.3.3 is the method of using a major version or a minor version.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.