How to clear html page cache

王林
Release: 2020-08-27 16:43:40
forward
4571 people have browsed it

How to clear html page cache

When the page is opened, the newly updated data sometimes cannot be refreshed in time due to the existence of cache. The problem is more obvious when the page is opened as a modal window.

(Recommended tutorial: html tutorial)

So how should we solve this problem?

The solution is:

(1) Use HTML tags to set HTTP header information

<HEAD>
<METAHTTP-EQUIV="Pragma"CONTENT="no-cache">
<METAHTTP-EQUIV="Cache-Control"CONTENT="no-cache">
<METAHTTP-EQUIV="Expires"CONTENT="0">
</HEAD>
Copy after login

Explanation: HTTP header information "Expires" and "Cache-Control" are applications The server provides a mechanism to control caching on browsers and proxy servers. The HTTP header Expires tells the proxy server when its cached page will expire. The newly defined header information Cache-Control in the HTTP1.1 specification can inform the browser not to cache any pages. When the back button is clicked, the browser revisits the server to obtain the page. The following is the basic method of using Cache-Control:

(Learning video recommendation: html video tutorial)

1. no-cache: Force the cache to obtain new data from the server Page

2. no-store: The cache does not save any page in any environment

Pragma: no-cache in the HTTP1.0 specification is equivalent to Cache- in the HTTP1.1 specification Control:no-cache can also be included in the header information.

(2) Add a random parameter after the url that needs to be opened:

Before adding parameters: url=test/test.jsp

After adding parameters: url= test/test.jsp?ranparam=random()

Explanation: Because the parameters behind the URL of each request are different, it is equivalent to requesting a different page. Use this method to save the country and clear the cache. .

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

Related labels:
source:csdn.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
Popular Tutorials
More>
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!