Html 使用 Meta 标记防止 Firefox 在刷新时记住输入值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2486474/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 02:31:41  来源:igfitidea点击:

Preventing Firefox from remembering the input value on refresh with Meta tag

htmlfirefoxforms

提问by Nir

When I refresh a page with Firefox, the values of the check boxes, input fields etc. are kept.

当我用 Firefox 刷新页面时,复选框、输入字段等的值被保留。

Is there a way to make Firefox not keep them, using a meta tag without JavaScript?

有没有办法让 Firefox 不保留它们,使用没有 JavaScript 的元标记?

回答by True Soft

For a inputtag there's the attribute autocompleteyou can set:

对于input标签,autocomplete您可以设置以下属性:

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

You can use autocomplete for a formtoo.

您也可以使用自动完成功能form

回答by Janardhan Chinta

// IE fix - do this at the end of the page
var oninit_async_reset = setInterval(function() { resetFormIEFix(); }, 500);
function resetFormIEFix() {
    $('#inputid').val('');
    if (typeof oninit_async_reset != 'undefined')
        clearInterval(oninit_async_reset);
}