[It168 technology] The following are four methods to prohibit Caching:
1. The client cache should include the following content in the head:
<! -- <Br/> code highlighting produced by actipro codehighlighter (freeware) <br/> http://www.CodeHighlighter.com/<br/> --> <meta HTTP-EQUIV = "Pragma" content = "no-Cache">
<Meta HTTP-EQUIV = "cache-control" content = "no-cache, must-revalidate">
<Meta HTTP-EQUIV = "expires" content = "wed, 26 Feb 1997 08:21:57 GMT">
Or
<! -- <Br/> code highlighting produced by actipro codehighlighter (freeware) <br/> http://www.CodeHighlighter.com/<br/> --> <meta http-equiv = "Pragma" content = "no-Cache">
<Meta http-equiv = "cache-control" content = "no-Cache">
<Meta http-equiv = "expires" content = "0">
2. Disable caching on the dynamic web page of the server. Add a script similar to the following:
<! -- <Br/> code highlighting produced by actipro codehighlighter (freeware) <br/> http://www.CodeHighlighter.com/<br/> --> response. setheader ("Pragma", "No-Cache ");
Response. setheader ("cache-control", "No-Cache ");
Response. setdateheader ("expires", 0 );
3. Set a limited time cache:
<! -- <Br/> code highlighting produced by actipro codehighlighter (freeware) <br/> http://www.CodeHighlighter.com/<br/> --> int minutes = 10;
Date d = new date ();
String moddate = D. togmtstring ();
String expdate = NULL;
Expdate = (new date (D. gettime () + minutes * 60000). togmtstring ();
Response. setheader ("last-modified", moddate );
Response. setheader ("expires", expdate );
Response. setheader ("cache-control", "public"); /// HTTP/1.1
Response. setheader ("Pragma", "Pragma"); /// HTTP/1.0
Suggestion: It is recommended that JSP cache be implemented on the filter, so that the pages to be buffered are concentrated in the same directory. You only need to modify web. XML to complete the buffer settings for each change, which is more convenient.
4. If none of the above methods works, add a tail after your normal URL.
In JS, select:
<! -- <Br/> code highlighting produced by actipro codehighlighter (freeware) <br/> http://www.CodeHighlighter.com/<br/> --> var timestamp = (new date ()). valueof ();
URL + "& timestamp =" + timestamp;
In the Java code, select:
<! -- <Br/> code highlighting produced by actipro codehighlighter (freeware) <br/> http://www.CodeHighlighter.com/<br/> --> long timestamp = new date (). gettime ();
URL + "& timestamp =" + timestamp;
In this case, your url is always changing, and the browser will have to update it honestly, and there is no buffer available.