Preventing Firefox from remembering the input value on refresh with a meta tag
For an input
tag there's the attribute autocomplete
you can set:
<input type="text" autocomplete="off" />
You can use autocomplete for a form
too.
If you want to prevent remembering field values after reload, while still getting to use autocomplete:
First define autocomplete off in the markup:
<input id="the-input" type="text" autocomplete="off" />
Then re-enable autocomplete programatically:
document.getElementById('the-input').autocomplete = 'on';
this will disable autocomplete just at the right time when the page loads and re-enable it so it can be used (but the field value will be empty as it should).
If it does not work for you, try wrapping the js code in a setTimeout
or requestAnimationFrame
.