Preventing Firefox from remembering the input value on refresh with a meta tag

HtmlFirefoxForms

Html Problem Overview


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

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

Html Solutions


Solution 1 - Html

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.

Solution 2 - Html

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.

Solution 3 - Html

// Internet Explorer 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);
}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNirView Question on Stackoverflow
Solution 1 - HtmlTrue SoftView Answer on Stackoverflow
Solution 2 - HtmlMaciej KrawczykView Answer on Stackoverflow
Solution 3 - HtmlJanardhan ChintaView Answer on Stackoverflow