Browser used: chrome on PC, various browsers on mobile phone
Visit the same url address: http://xxx.aaa.bbb.com/ship.html
In the test environment: Some students visited this address. When they visited again, the page still displayed the data from the last time they visited the page, which was not the latest data. Check its http, there are several important parameters as follows: 200, from cache. However, every time some students visit this address, the page shows the latest data. When checking several important http parameters, from cache does not appear.
from cache I understand, but what I don’t understand is why some students appear from cache when accessing the same server, while some students load the latest page data from the server when accessing. What does this have to do with, and what influences it?
Note:
In the official online environment, this problem does not exist, access is normal, and the latest page data is loaded from the server every time.
ship.html is not a straight static page, it is pseudo-static.
The following headers have been set: <meta http-equiv="Expires" content="-1">
<meta http-equiv="Cache-Control" content="no-cache ">
<meta http-equiv="Pragma" content="no-cache">
Browser used: chrome on PC, various browsers on mobile phone
Visit the same url address: http://xxx.aaa.bbb.com/ship.html
In the test environment: Some students visited this address. When they visited again, the page still displayed the data from the last time they visited the page, which was not the latest data. Check its http, there are several important parameters as follows: 200, from cache. However, every time some students visit this address, the page shows the latest data. When checking several important http parameters, from cache does not appear.
from cache I understand, but what I don’t understand is why some students appear from cache when accessing the same server, while some students load the latest page data from the server when accessing. What does this have to do with, and what influences it?
Note:
In the official online environment, this problem does not exist, access is normal, and the latest page data is loaded from the server every time.
ship.html is not a straight static page, it is pseudo-static.
The following headers have been set: <meta http-equiv="Expires" content="-1">
<meta http-equiv="Cache-Control" content="no-cache ">
<meta http-equiv="Pragma" content="no-cache">
If the server does not clearly define cache control, different clients may have different caching mechanisms.
If you want users to get the latest data every time, you can set the meta tag like this:
<code class="html"><meta http-equiv="cache-control" content="max-age=0" /> <meta http-equiv="cache-control" content="no-cache" /> <meta http-equiv="expires" content="0" /> <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" /> <meta http-equiv="pragma" content="no-cache" /></code>
Setting the meta tag is only effective for html pages. A better way is to set cache control in the http response header:
<code class="http">Cache-Control: no-cache, no-store, must-revalidate Pragma: no-cache Expires: 0</code>
php sets http response header code:
<code class="php">header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1. header("Pragma: no-cache"); // HTTP 1.0. header("Expires: 0"); // Proxies.</code>
Using caching can help speed up page loading and reduce resource consumption. You should adjust the caching strategy according to the specific situation.
http://stackoverflow.com/ques...
http://stackoverflow.com/ques...