MENU service case
 Website construction website design Beijing website construction high-end website production company Shangpin China
We create by embracing change
360 ° brand value__
simplified Chinese character
Simplified Chinese English

Shangpin China Joins Hands with Beisheng Internet to Create a New Chapter in Website Construction

Type: Shangpin Dynamic Learn more

How to update css and js links in cached HTML

Source: Shangpin China | Type: website encyclopedia | Date: 2013-02-16
Beijing website construction Company Shangpin China: Search for the keyword. htaccess cache in the search engine. You can find many tutorials about setting up website file cache. By setting, you can cache files that are not updated frequently, such as css and js, on the browser side, so that visitors can visit your Website production The browser can get css, js, etc. from the browser's cache without having to read from your server, which speeds up the opening of the website to a certain extent and saves your server traffic.

Now comes the problem. The css and js caches set by. htaccess have an expiration time. If the css and js have been cached in the visitor's browser, the browser will only read the css and js from the cache before these css and js caches expire. If you modify the css and js on the server, these changes will not change in the returning visitor's browser, Unless repeat customers press Ctrl+F5 to refresh your website page or manually clear the browser cache. There are thousands of visitors to a website, and there will be many repeat visitors. You can't let every visitor refresh the cache after updating the css. How will you deal with this problem?

Treatment
1. Add a version number to the css file: In fact, it is a bit troublesome to change the file name of the css file after each modification of the css file. Then we can add a version number (that is, the content behind the "" in the css link) to the load css statement. For example, the css call statement in the original html is as follows:

Change the version number of the css file to 2012:
2. Change the css file name: In fact, it is very simple to solve this problem. The cache marks the cache content through the file name. After you update the content of the website's css file, you can change the name of the css file. For example, the css call statement in the original html is as follows:

Just change the name of the css file:
Another way to change the css file name is to write the version number to the file name
After the css file is updated, change the version number in the file name:
In fact, the question mark behind the css file can only be used as a suffix. If you use the question mark plus parameter method, you can add version number and other information, and refresh the browser side cache. A small detail can bring us great convenience.
This article was published on Beijing website production Company Shangpin China //ihucc.com/
Source Statement: This article is original or edited by Shangpin China's editors. If it needs to be reproduced, please indicate that it is from Shangpin China. The above contents (including pictures and words) are from the Internet. If there is any infringement, please contact us in time (010-60259772).
TAG label:

What if your website can increase the number of conversions and improve customer satisfaction?

Make an appointment with a professional consultant to communicate!

* Shangpin professional consultant will contact you as soon as possible

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]

Communicate with professional consultants now!

  • National Service Hotline

    400-700-4979

  • Beijing Service Hotline

    010-60259772

Please be assured to fill in the information protection
Online consultation

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]