meta方法
//不缓存
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="0">
jquery ajax清除浏览器缓存
方式一:用ajax请求服务器最新文件,并加上请求头If-Modified-Since和Cache-Control:
$.ajax({
url:'www.haorooms.com',
dataType:'json',
data:{},
beforeSend :function(xmlHttp){
xmlHttp.setRequestHeader("If-Modified-Since","0");
xmlHttp.setRequestHeader("Cache-Control","no-cache");
},
success:function(response){
//... ....
} ,
async:false ;
});
方法二,直接用cache:false
$.ajax({
url:'www.haorooms.com',
dataType:'json',
data:{},
cache:false,
ifModified :true ,
success:function(response){
//... ....
}
,async:false ;
});
方法三:用随机数
URL?ran=" + Math.random();