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

How to disable caching in html

藏色散人
Release: 2023-01-03 09:31:33
Original
8582 people have browsed it

How to disable caching of html: First open the corresponding HTML file; then use the "" 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">
Copy after login

2, CSS and JS file

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

changed to

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

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!

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template