您的位置:首页 > 其它

禁止火狐浏览器缓存input标签

2013-11-07 18:26 281 查看


如果你想让Firefox没有这么智能,不缓存你的input的值的话,需要进行如下修改:

<form>
<input autocomplete="off" type="text" /><br />
<input autocomplete="off" type="text" /><br />
<input autocomplete="off" type="text" /><br />
<input autocomplete="off" type="text" /><br />
</form>


以上代码,给每一个input加上一个 autoconplete="off" 的属性,这样,就能阻止Firefox的默认缓存机制了。刷新之后,这些input的值都初始化。

还有一个写法,可以把全个表单中所有input都设置为不缓存的:

<form autocomplete="off">
<input type="text" /><br />
<input type="text" /><br />
<input type="text" /><br />
<input type="text" /><br />
</form>


http://www.mayax.net/article/program/331.htm
其他几种禁止浏览器缓存页面的方法:

1.在要禁止缓存的页面<head>中加以下脚本:

 JSP代码  
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">


  

2.在要禁止缓存的页面<head>中加以下脚本:

JSP代码

<%
response.setHeader("Cache-Control","no-cache");
response.setHeader("Pragma","no-cache");
response.setDateHeader ("Expires", 0);
%>


参考网址:
http://oldboy.iteye.com/blog/466595 ie和火狐缓存的区别
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息