Solve a problem – Filter by language, license, keyword, owner, or search text to find code & info fast. Join Siafoo Now or Learn More

Stop Firefox from Persisting Select Box State across Reloads Atom Feed 0

When you reload a page with a selection box in it, Firefox keeps the selection box at its old option, even if the default in the HTML has changed. To fix it, add 'autocomplete="off"' to your form.

Firefox caches form data. This is fine most of the time, but sometimes when you reload a page the form defaults change. By default, Firefox doesn't realize this for select boxes.

Reloading the page via another method, like highlighting the current url and pressing enter, works as expected: all fields are updated.

The solution is to add the attribute autocomplete="off" to the form element containing the troubled select box.

For a good example of how things should work, check out the Siafoo Syntax Highlighting Demo. (Shameless self-promotion)

Further Reading

nodans.com - Firefox Caches Select Box State
I found the solution in the comments of this post.