Prevent page clients from being cached
many browsers in order to quickly show users the requested page, will be from the server's Web page in the client's cache, if the user multiple
requests access to the same Web page on the server side, and the Web page already exists in the client's cache at middle age, then the browser only needs to get the page from the cache
, you do not need to request access to a Web page on a remote server
the browser-side caching technology is suitable for storing static Web pages on the server side, and for Web pages that do not contain sensitive data, in which case the server is often
you do not want the client to be cached by the browser:
(1) The Web page contains dynamic content that will be updated at any time, because if the browser presents the page to the user in the local cache, it may show an outdated page
(2) A webpage contains sensitive data, such as bank account information for a particular user, e-mail content, because if the browser saves the Web page in the local cache
It is possible for other unauthorized users to access the page
server-side HttpServlet can prevent clients from caching Web pages by setting specific HTTP response headers .
Response.AddHeader ("Pragma", "No-cache");
Response.setheader ("Cache-control", "No-cache");
Response.setheader ("Expires", "0");
The "Parama" option is suitable for browsers with HTTP1.0, and in HTTP1.1, the "cache-control" option is used to determine whether the client can cache the Web page, if the value is
"No-cache" then the client does not save the servlet-generated pages in the local cache, HTTP1.0 and HTTP1.1 support the "Expires" option
This option is therefore recognized by all browsers, and the "Expires" option is used to set the time that the page expires, if 0, to expire immediately if the user repeatedly requests access to the
Web site, the browser should always get the latest Web page data from the server side
Prevent page clients from being cached