AJAX防止頁面緩存的代碼
更新時間:2007年06月03日 00:00:00 作者:
采用AJAX技術的時候 通常我們無刷新頁面提交數(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");
相關文章
用ajax實現(xiàn)預覽鏈接可以看到鏈接的內(nèi)容
用CSS設置預覽彈出窗口的樣式、用JavaScript進行服務器請求并且顯示彈出窗口,需要的朋友可以參考下2014-08-08ajax實現(xiàn)改變狀態(tài)和刪除無刷新的實例
下面小編就為大家分享一篇ajax實現(xiàn)改變狀態(tài)和刪除無刷新的實例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2017-12-12