有時候緩存會給程序帶來很大的麻煩,這段代碼是用來清空IE緩存裡的內容
1.禁止客戶端緩存要在<head>中加入類似如下內):
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
2.在服務器的動態網頁中禁止緩存,要加入類似如下腳本
(1)ASP:
<%
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.cachecontrol = "no-cache"
%>
或者
<%
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);