Today i StumbleUpon a strange cache behavior of Firefox 4 which is described bellow.
There is a form
<form name="widget"> <input type="hidden" name="position" value="-1" /> </form>
On an arbitrary event i have changed it to say "rss".
After refreshing the page using "F5", i access the value of
which is returning "rss". WHY THE OLD VALUE?alert(document.widget.position.value);
But开发者_如何学Go after refreshing the page using "Control+F5", i access the value of
which is returning correct "-1". WHY NOT FIRST TIME?alert(document.widget.position.value);
I am really confused by this behavior.
NOTE: Only FireFox4 is doing it, chrome i fine but did not tested on ie.
I think it's FF's caching of forms/input element values that's bugging you. You may want to use:
<form id="widget">
<input type="hidden" id="position" value="-1" />
</form>
and to change the value:
document.getElementById('position').value = /*[your value]*/;
Furthermore <form ... autocomplete="off">
seems to work.
精彩评论