AJAX防止頁面緩存的代碼
更新時間:2007年06月03日 00:00:00 作者:
采用AJAX技術(shù)的時候 通常我們無刷新頁面提交數(shù)據(jù)后 用同樣的url去獲取數(shù)據(jù)的時候會發(fā)現(xiàn)是以前的數(shù)據(jù)~那樣就給client端帶來假象了~~ 采用以下的方法可以取消緩存
htm網(wǎng)頁
<metahttp-equiv="pragma"content="no-cache">
<metahttp-equiv="cache-control"content="no-cache,must-revalidate">
<metahttp-equiv="expires"content="wed,26feb199708:21:57gmt">
或者<metahttp-equiv="expires"content="0">
asp網(wǎng)頁
response.expires=-1
response.expiresabsolute=now()-1
response.cachecontrol="no-cache"
php網(wǎng)頁
header("expires:mon,26jul199705:00:00gmt");
header("cache-control:no-cache,must-revalidate");
header("pragma:no-cache");
jsp網(wǎng)頁
response.addHeader("pragma", "no-cache");
response.addHeader("cache-control", "no-cache,must-revalidate");
response.addHeader("expires", "0");
htm網(wǎng)頁
<metahttp-equiv="pragma"content="no-cache">
<metahttp-equiv="cache-control"content="no-cache,must-revalidate">
<metahttp-equiv="expires"content="wed,26feb199708:21:57gmt">
或者<metahttp-equiv="expires"content="0">
asp網(wǎng)頁
response.expires=-1
response.expiresabsolute=now()-1
response.cachecontrol="no-cache"
php網(wǎng)頁
header("expires:mon,26jul199705:00:00gmt");
header("cache-control:no-cache,must-revalidate");
header("pragma:no-cache");
jsp網(wǎng)頁
response.addHeader("pragma", "no-cache");
response.addHeader("cache-control", "no-cache,must-revalidate");
response.addHeader("expires", "0");
相關(guān)文章
基于ajax實(shí)現(xiàn)點(diǎn)擊加載更多無刷新載入到本頁
本文給大家介紹通過ajax技術(shù)實(shí)現(xiàn)無刷新加載更多載入到本頁,感興趣的朋友一起學(xué)習(xí)吧2015-10-10用ajax實(shí)現(xiàn)預(yù)覽鏈接可以看到鏈接的內(nèi)容
用CSS設(shè)置預(yù)覽彈出窗口的樣式、用JavaScript進(jìn)行服務(wù)器請求并且顯示彈出窗口,需要的朋友可以參考下2014-08-08ajax實(shí)現(xiàn)改變狀態(tài)和刪除無刷新的實(shí)例
下面小編就為大家分享一篇ajax實(shí)現(xiàn)改變狀態(tài)和刪除無刷新的實(shí)例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2017-12-12