有没有办法告诉Firefox不要记住页面刷新时我的输入字段的状态? [英] Is there a way to tell Firefox not to remember the state of my input fields on page refresh?
问题描述
示例:
< html>
< head>
< script src =https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js>< / script>
< / head>
< body>
< input type =textvalue =textbox/>
< / body>
< / html>
上面的代码有一个锚点,当点击时,禁用文本输入字段。之后,Firefox会记住F5之后的状态,唯一的方法就是将它恢复到原来的地址栏。
是否有meta标签或什么使FF停止这样做?
编辑
您可以设置元素或窗体autocomplete =off禁用状态保存,当然也禁用输入自动完成。
Firefox has a very annoying feature. It remembers the state of input fields when you hit F5. It's not just the value, it remembers even whether the input is disabled or not.
Example:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
</head>
<body>
<input type="text" value="textbox" />
<a href="#" onclick="javascript: $('input').attr('disabled', true); return false; " >Disable text box</a>
</body>
</html>
The code above has an anchor that, when clicked, disables the text input field. After that, Firefox will remember the state after F5 and the only way to restore it to the original is to hit enter on the address bar.
Is there a meta tag or something to make FF stop doing that?
EDIT
Actually browsers have different behaviors. Firefox is the most annoying. Firefox remembers the input value and whether it's disabled or not. IE8 remembers the value and Chrome doesn't remember anything
You can set the element or the form to autocomplete="off" to disable state preservation, but that also disables input autocomplete, of course.
这篇关于有没有办法告诉Firefox不要记住页面刷新时我的输入字段的状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!