" statement to disable caching of the page."/> " statement to disable caching of the page.">

Home >Web Front-end >Front-end Q&A >How to disable caching in html

How to disable caching in html

藏色散人
藏色散人Original
2021-03-29 10:33:528579browse

How to disable caching of html: First open the corresponding HTML file; then use the "2f4bdd460527504d12767d1a307669e1" statement to disable caching of the page.

How to disable caching in html

The operating environment of this article: windows7 system, HTML5&&CSS3 version, DELL G3 computer

HTML page caching is prohibited

Everyone may have encountered the problem of page caching. Many functions have no effect after completion, so how to solve this problem? Here is my solution

For an html page, caching Divided into 3 parts, one is page content, one is css style, one is JS file

1, page content

<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache" content="no-cache">

2, CSS and JS file

<link rel="stylesheet" href="../css/register.css"/>
<script src="../scripts/register.js"></script>

changed to

<link rel="stylesheet" href="../css/register.css?v=20161020"/>
<script src="../scripts/register.js?v=20161020"></script>

Just change the version number after each modification

In this way, you have to change it after every modification. Is there anything that automatically adds the version number? I guess there is, if it is JSP and php can be automatically generated through script

. If it is pure html, it can also be generated through document.write, or a dynamically loaded JS framework or something.

Recommended study: "HTML Video Tutorial"

The above is the detailed content of How to disable caching in html. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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