禁止網(wǎng)頁緩存等于返回刷新網(wǎng)頁
有時在網(wǎng)頁制作時并不太希望網(wǎng)頁保存緩存,比如在填寫表單返回時,又或者在登陸退出后直接輸入地址還能回到緩存頁面,這時后你不用想破腦袋來解決如果返回刷新數(shù)據(jù)的問題,網(wǎng)頁端禁止緩存就行了。
HTML禁止網(wǎng)頁緩存方法:
<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禁止網(wǎng)頁緩存方法:
response.expires=0
response.addHeader("pragma","no-cache")
response.addHeader("Cache-Control","no-store, must-revalidate")
PHP網(wǎng)頁禁止緩存方法:
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-store, must-revalidate");
header("Pragma: no-cache");
JSP網(wǎng)頁禁止緩存方法:
response.addHeader("Cache-Control", "no-store, must-revalidate");
response.addHeader("Expires", "Thu, 01 Jan 1970 00:00:01 GMT");