有时候缓存会给程序带来很大的麻烦,这段代码是用来清空IE缓存里的内容
1.禁止客户端缓存要在<head>中加入类似如下内):
<META HTTP-EQUIV="pragma" C> <META HTTP-EQUIV="Cache-Control" C> <META HTTP-EQUIV="expires" C> |
2.在服务器的动态网页中禁止缓存,要加入类似如下脚本
(1)asp:
<% Response.Expires = -1 Response.ExpiresAbsolute = Now() - 1 Response.cachec %> 或者 <% pStr = "private, no-cache, must-revalidate" Response.ExpiresAbsolute = date() Response.AddHeader "pragma", "no-cache" Response.AddHeader "cache-control", pStr %> |
(2)jsp:
response.setHeader("Pragma","No-cache"); response.setHeader("Cache-Control","no-cache"); response.setDateHeader("Expires", 0); |