Prevent page clients from being cached

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.