no cache

为了安全起见,用户退出需要认证的 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
response.expires=0
response.addHeader("pragma","no-cache")
response.addHeader("Cache-Control","no-cache, must-revalidate")

PHP
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");

JSP:
response.addHeader("Cache-Control", "no-cache");
response.addHeader("Expires", "Thu, 01 Jan 1970 00:00:01 GMT");

 

参考资料:

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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值