In the speed of finding a lot of ways, and finally solved the
In fact the easiest way is to add <meta> label to the head
<meta http-equiv= "Cache-control" content= "No-cache,no-store, must-revalidate" >
<meta http-equiv= "Pragma" content= "No-cache" >
<meta http-equiv= "Expires" content= "0" >
You can also use program control
Copy Code code as follows:
<?php
Header ("Cache-control:no-cache,no-store,must-revalidate");
Header ("Pragma:no-cache");
Header ("expires:0");
?>
If in <meta http-equiv= "Cache-control" content= "No-cache,no-store, must-revalidate" > or Header ("Cache-control: No-cache,no-store,must-revalidate "); No-store won't solve Firefox's cache.
Here's a specific analysis for you.:
two important differences between Firefox and IE browser caching
When you create a Web service, there are usually two types of caches that need to be configured:
When you set up a Web site with an update, the HTML resource expires immediately so that the user you are browsing can quickly be updated.
Set all other resources (such as pictures, css,javascript scripts) to expire after a certain amount of time.
This caching scheme covers some ideas about how to handle updates in the two simple Rules for HTTP caching article.
Now that HttpWatch 6.0 supports Firefox, we want to explore how Firefox differs from IE in terms of processing caching. Setting a longer expiration time (the second above) can still be used directly for Firefox, but configuration 1 is slightly different between the two.
In previous articles, we divided the first article into:
Sometimes dynamic HTML pages need to be updated instantly from the server for display-even when using the back button. For example, display the status of a bank account or an online order.
Static HTML pages, such as Contacts, FAQs, or site maps, if they have a last-modified response header, allow the browser to verify when needed, so that the cache can be used.
The remainder of this article explores two important differences in Firefox that affect HTML page caching.
1. Use No-cache to prevent Firefox cache from being invalidated
You can simply set the following response headers to prevent IE cache anything:
Cache-control:no-cache
Pages that use this response header are not saved in the cache, IE will always reload from the server, even if you use the Back button. The following example uses HttpWatch to monitor an online store, and when we click the Back button after submitting the order form, the results are as follows:
However, this response header does not prevent Firefox from caching. This means that Firefox, in normal access, will always use the cached page until it sends a GET request to re-examine it. Also, if the page is accessed by the Back button, Firefox will not access the server again, Instead, it simply loads directly from the cache.
So how do you turn off the cache in Firefox? The answer is simple, it can't be closed. Because Firefox relies on a copy of the cache for "file-> Save as", "View source code" operation services. However, you can control where the page is cached and which cached entries can be used for display.
The following response headers in Firefox prevent persistent caching, forcing the page to be cached in memory:
Cache-control:no-store
This header can also prevent the cached page from being accessed when the back button is used, which triggers an HTTP GET request.
The combination of the values of these two response headers can be expected in IE and Firefox:
Cache-control:no-cache, No-store
As shown in the following HttpWatch response header label:
2. If you do not set an expiration time Firefox will set one for you when IE encounters an HTTP response without a expires header, it thought that the cache entry would never be automatically used until it was again validated from the service. A setting item for IE's temporary file "check the newer version of the Web page" defaults to " Automatic, so it's usually a session done once.
This provides a reasonable way to control the caching of static HTML content. The user's newly opened IE will get the latest version of the HTML, and the cached version will be used until the IE is closed.
Firefox handles missing expires headers differently. If the effect has a last-modified header, it will use one of the attempted expiration values specified in the HTTP 1.1 specification RFC2616:
(
Reference Specification:)
Also, if there is a last-modified time value in the response, the attempted expiration value cannot exceed a ratio of this value to the current time interval, typically setting this ratio to 10%.
The calculation method is as follows:
Expiry time = Now time + 0.1 * (last-modified to present times)
For example, if your static HTML file was last modified 100 days ago, the expiration date is 10 days. The following example is a HttpWatch cache label with no Expires header page:
Pic3
Firefox automatically sets the expiration time to 8 days, because the page has not been modified for about 80 days.
This means that in order to keep your HTML pages in good control, as we discussed in the two simple Rules for HTTP caching article, you'd better for your static resources such as HTML, pictures, CSS files, etc., Set an appropriate expires value on your Web server.
Conclusions
To ensure that IE is consistent with Firefox's caching behavior, you should:
Always specify a expires header. General Settings-1 use HTML pages to instantly refresh or set a specific expiration time for other images, such as Css,javascript script resources
If you want to force the page to refresh, or even click the background button, then set Cache-control:no-cache, No-store