AJAX防止页面缓存的代码
采用AJAX技术的时候 通常我们无刷新页面提交数据后 用同样的url去获取数据的时候会发现是以前的数据~那样就给client端带来假象了~~ 采用以下的方法可以取消缓存
htm网页
<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网页
response.expires=-1
response.expiresabsolute=now()-1
response.cachecontrol="no-cache"
php网页
header("expires:mon,26jul199705:00:00gmt");
header("cache-control:no-cache,must-revalidate");
header("pragma:no-cache");
jsp网页
response.addHeader("pragma", "no-cache");
response.addHeader("cache-control", "no-cache,must-revalidate");
response.addHeader("expires", "0");
htm网页
<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网页
response.expires=-1
response.expiresabsolute=now()-1
response.cachecontrol="no-cache"
php网页
header("expires:mon,26jul199705:00:00gmt");
header("cache-control:no-cache,must-revalidate");
header("pragma:no-cache");
jsp网页
response.addHeader("pragma", "no-cache");
response.addHeader("cache-control", "no-cache,must-revalidate");
response.addHeader("expires", "0");
相关推荐
chenhaimeimeng 2020-08-15
拾毅者 2020-09-14
LxyPython 2020-08-17
yaodilu 2020-01-06
似水流年梦 2019-12-03
bobboy00 2014-03-19
wangdoudou0 2015-07-20
MrWhite0 2016-05-03
huzijia 2019-05-18
古人云小程序 2019-04-30
yanghui0 2016-09-27
vavid 2012-11-22
88407013 2012-06-28
彼岸的云 2010-06-12
89520292 2011-07-27
82443365 2011-05-29
87457808 2014-05-17
owhile 2017-08-29
丁丁爸爸的技术 2017-01-10