http-equiv="Pragma"
contect="no-cache">是用于设定禁止浏览器
从本地机的缓存中调阅页面内容,设定后一旦离开网页就无法从Cache中再调出;
HTTP协议中关于缓存的信息头关键字包括Cache-Control(HTTP1.1),Pragma(HTTP1.0),last-Modified,Expires等。
设置响应请求头为 Cache-Control: no-cache,max-age=0
保证了html不缓存,这样资源文件只需要在后面拼接时间戳或者版本号就能实现该缓存时缓存,页面更新时保证更新
HTML:<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<META HTTP-EQUIV="expires" CONTENT="0">
ASP
response.expires=0
response.addHeader("pragma","no-cache")
response.addHeader("Cache-Control","no-store, must-revalidate")
PHP
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT")
header("Cache-Control: no-store, must-revalidate")
header("Pragma: no-cache")
JSP:
response.addHeader("Cache-Control", "no-store, must-revalidate")
response.addHeader("Expires", "Thu, 01 Jan 1970 00:00:01 GMT")
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)