Disable Caching: Add a timestamp to css/js.

Source: Internet
Author: User

Many servers or CDN will cache static content such as CSS, JS, and images. on IE, a local cache will be made. Therefore, after we update the CSS file, the client is often not updated, resulting in display problems. Previously, I used the timestamp parameter method to solve the problem:

Each time the css file is changed, the value of the parameter time is set to the date of the day of change, so that local IE will update it as a new file.

However, a strange problem was found in a recent project. The server was compressed with gzip, and it was okay when the client was unzipped for the first time, during the second access, ie could read the file from the cache and only read the first 1000 or 2000 bytes. This problem was reproduced on two win2000 + ie6 hosts, but XP has not yet been found.

The final solution is to add a. CSS end after the time stamp, that is, to write it:

Then everything is normal...

IE may have to make a judgment on the file extension when reading files from the cache, so add it to recognize it.

Of course, js can also use this method.

Source: http://www.iamued.com/qianduan/1629.html

Related Article

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.