开发者

strange cache issue : FireFox4

开发者 https://www.devze.com 2023-03-06 20:06 出处:网络
Today i StumbleUpon a strange cache behavior of Firefox 4 which is described bellow. There is a form <form name=\"widget\">

Today i StumbleUpon a strange cache behavior of Firefox 4 which is described bellow.

  1. There is a form

    <form name="widget">
    <input type="hidden" name="position" value="-1" />
    </form>

  2. On an arbitrary event i have changed it to say "rss".

  3. After refreshing the page using "F5", i access the value of

    alert(document.widget.position.value);
    which is returning "rss". WHY THE OLD VALUE?

  4. But开发者_如何学Go after refreshing the page using "Control+F5", i access the value of

    alert(document.widget.position.value);
    which is returning correct "-1". WHY NOT FIRST TIME?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消