当前位置: 代码迷 >> HTML/CSS >> 设立html页面不让浏览器缓存的方法
  详细解决方案

设立html页面不让浏览器缓存的方法

热度:21   发布时间:2012-11-01 11:11:32.0
设置html页面不让浏览器缓存的方法
在html头中加入以下3句话,可以防止大部分浏览器缓存
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
<meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
或者js中加入类似下面的代码,让每次的链接都不一样
var s=Math.random()*10;
????document.getElementById("checkCodeImg").innerHTML="<img src='/checkcode.jsp?rnd="+s+"'/>";
  相关解决方案