HTML页面和JSP页面禁止缓存

一、JSP页面禁止缓存:

防止浏览器缓存当前访问的JSP动态页面,可以采用如下的方式进行设置,此效果如下的“HTML禁止缓存”:

%
 将过期日期设置为一个过去时间
response.setHeader(Expires, Sat, 6 May 1995 120000 GMT);
 设置 HTTP1.1 no-cache 头
response.setHeader(Cache-Control, no-store,no-cache,must-revalidate);
 设置 IE 扩展 HTTP1.1 no-cache headers, 用户自己添加
response.addHeader(Cache-Control, post-check=0, pre-check=0);
 设置标准 HTTP1.0 no-cache header.
response.setHeader(Pragma, no-cache);
%

服务器的动态网页中禁止缓存,要加入类似如下脚本
response.setHeader(Pragma,No-cache);
response.setHeader(Cache-Control,no-cache);
response.setDateHeader(Expires, 0); 

服务器端禁止缓存
%
Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = no-cache

%

二、HTML页面禁止浏览器缓存

META HTTP-EQUIV=pragma CONTENT=no-cache

META HTTP-EQUIV=Cache-Control CONTENT=no-cache, must-revalidate
META HTTP-EQUIV=expires CONTENT=0

原文地址:https://www.cnblogs.com/webqiand/p/4318742.html