为了安全起见,用户退出需要认证的 web 页面以后,需要阻止浏览器使用 history 的 back 功能。以下记录一些相关的处理方式。
jetty 服务器,jsp 页面,包括在 iframe 中。
先增加:
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="expires" CONTENT="-1">
没有效果。
再增加:
response.addHeader("Cache-Control", "no-cache");
response.addHeader("Expires", "Thu, 01 Jan 1970 00:00:01 GMT");
搞定。
下表包括完整的说明:
HTTP: <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="0"> ASP PHP JSP: |
参考资料:
So, You Don't Want To Cache, Huh?
http://www.htmlgoodies.com/beyond/reference/article.php/3472881
No Cache
http://www.codeave.com/html/code.asp?u_log=5080
说明得很详细。但是,在 iframe 里面,好像不是很管用。
Useful META TAGS Table of Contents
http://www.i18nguy.com/markup/metatags.html
Html+asp+php+jsp:4种语言禁止浏览器缓存页面的方法
http://help.hxxw.com/list.asp?id=30
浏览器禁止缓存
http://www.360doc.com/showWeb/0/0/44233.aspx
对于 jsp 和 struts 页面,禁用缓存,作了比较全面的说明。
高级表单验证-针对多次提交表单
http://www.pcdog.com/p/html/20041219/191220047005_1.htm
对于 asp 的阻止,评析了若干方法。
下面是当时收集的其他的一些资料:
JSP彩色验证码
http://www.matrix.org.cn/resource/article/1/1346.html
从零开始创建基于struts1.2 + Hibernate3.0 Web工程(第一部分)
http://dev2dev.bea.com.cn/bbsdoc/2005111503.html
将JSP在内存生成的图片显示到页面
http://www.knowsky.com/4480.html
JSP生成彩色验证码
http://www.junesky.org/blog/article.asp?id=117