页面清缓存

window.onload=function(){
   var date=new Date();
    var meta='<meta http-equiv="Last-Modified" content="'+date+'"><meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /><meta http-equiv="Pragma" content="no-cache" /><meta http-equiv="Expires" content="0" />';
    $("head").prepend(meta);
}

动态给每个页面加meta标签

参考:http://www.haorooms.com/post/js_llq_hc

清理form表单的临时缓存

<body onLoad="javascript:document.yourFormName.reset()"> 

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(); //当然这里参数 ran可以任意取了
方法四:用随机时间,和随机数一样。
在 URL 参数后加上 "?timestamp=" + new Date().getTime();
用php后端清理
在服务端加 header("Cache-Control: no-cache, must-revalidate");等等(如php中)
原文地址:https://www.cnblogs.com/lmxxlm-123/p/9015019.html