一、
网上搜到的方法:
在head里加:
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
不过发现还是没用
二、
然后发现可能是因为用了ajax,发现在url上加个随机数就好了
function addrand(toLoad){
if(toLoad.indexOf('?')==-1)
toLoad +="?rnd="+Math.round(Math.random()*10000);
else
toLoad +="&rnd="+Math.round(Math.random()*10000);
return toLoad;
}
提交的时候
toLoad += addrand(toLoad);
$('#xx').load(toLoad,function(response, status, xhr){
...;
});
三、
然后发现原来jquery已经有个自动加随机数的设置了:
ajax的setting对象参数里加个属性 cache:false
如果要默认禁用缓存的话,在加载完成的回调函数里加一句$.ajaxSetup({cache:false});就好了
$(function(){
...
$.ajaxSetup({cache:false});
});
这里解释了ie和firefox的缓存机制,没仔细看,有空的时候去看看
http://blog.csdn.net/clam_clam/article/details/6574135