ZC:我的代码:
<!-- 防止大部分浏览器缓存: --> <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"> <meta http-equiv="expires" content="-1">
ZC:“<meta http-equiv="expires" content="0">” 还可以对照一下 韩顺平jsp的课程里面的内容,看看有无差别
ZC:我用了上面的代码,貌似 不一定有效...[ 我现在(20180403)主要是使用 "Chrome版本 65.0.3325.162(正式版本)(32 位)"(在Win7x64中使用) ]
ZC:网上搜到的 chrome的方式:网页中 按F12(右键菜单中 显示的是 "检查(N) Ctrl+Shift+I")(也就是:Chrome菜单-->更多工具()-->"开发者工具(D) Ctrl+Shift+I")(PS:这里的快捷键 是大写字母"I"),然后再在 "开发者工具"的界面里面 按 F1,来到 "Setting"界面-->在"Preferences"里面找到 "Network"下面的"Disable cache (while DevTools is open)",把它√选上。
1、
在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">
2、
或者 JavaScript中加入类似下面的代码,让每次的链接都不一样:
var s=Math.random()*10;
document.getElementById("checkCodeImg").innerHTML="<img src='/checkcode.jsp?rnd="+s+"'/>";
// *** *** *** *** *** *** *** ***
// *** *** *** *** *** *** *** ***
// *** *** *** *** *** *** *** ***
// *** *** *** *** *** *** *** ***