Timestamp allows js,css to not cache __js

Source: Internet
Author: User

A lot of Linux + Apache servers will be CSS, JS and pictures of these static content settings cache, to IE here will be a local cache. So when we update the CSS file, there are often no updates from the client, causing the problem to appear. I've been using timestamp parameters to solve the problem before:

<link rel= "stylesheet" type= "Text/css" href= "common.css?time=20060408"/> The value of the parameter time is set to the date of the change on the same day whenever the CSS file is changed. This way, local IE will update it as a new file.

But in the recent project to find a relatively strange problem, the server did gzip compression, to the first time the client decompression is no problem, the second visit when IE read files from the cache is a problem, can only read out the front about one thousand or two thousand bytes. The problem is reproduced on two win2000+ie6 machines, and XP has not yet been discovered.

The final solution is to add a. css ending after the timestamp parameter, which means:

<link rel= "stylesheet" type= "Text/css" href= "Common.css?time=20060408.css"/> Then everything is ok ...

Probably when IE reads a file from the cache, it has to make a judgment on the file name extension, so add it to the recognition. I'm not quite satisfied with this explanation, so if you have a standard answer, please leave a message.

Of course JS can also use this method <script language= "JavaScript" src= "/flash/duilian.js?time=new Date ()" ></script>

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.