]."/> ].">
Home > Article > Web Front-end > 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>
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!