HTML implements automatic cleaning of the cache of js and css files

王林
Release: 2020-03-02 18:04:52
forward
3512 people have browsed it

HTML implements automatic cleaning of the cache of js and css files

The method is as follows:

1. Manually clear the browser cache;

2. Add the version number (such as layout.css?v=1)

Personally, I think method 2 is faster, because clearing the browser cache requires waiting for the browser to respond. But it is troublesome to change the version number every time, so we need to find a way to automatically add the version number.

(Recommended tutorial:html tutorial)

Method 1: You can automatically add the version number to html through js

Copy after login

Method 2: If it is a jsp page , you can use java code to generate timestamps (if it is a jsp page, you can also use method 1, but this method is more convenient)

Copy after login

For more programming-related content, please pay attention to the php Chinese websiteIntroduction to ProgrammingColumn!

The above is the detailed content of HTML implements automatic cleaning of the cache of js and css files. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!