Safari and Chrome modify form data on the back button

I get this strange problem in Safari and Chrome (works in Firefox and IE).

  • I start with this checkbox list, which has the first element "A", but the elements "B" and "C" are not checked
  • Then go to another page that orders the items that appear in the checkbox list
  • I change the order of the items in the list, so now it goes 'B', 'A', 'C'
  • I press the back button
  • The page is reassigned from the server (caching is disabled for me), I check the response sent from the server, and the β€œA” element is still checked and is no longer the first item in the list.
  • !!! Strange behavior!!! The page is loaded in the browser with the new orders "B", "A", "C", but "A" is not checked; instead, the first element "B" is checked.

Somehow it seems that the position of the validation element was restored by clicking the "Back" button, and the form data was discarded, which were sent from the server.

When I refresh the page, now the order of "B", "A", "C" and the element "A" are now checked, and everything looks fine.

In both cases, the page has an IsPostBack value of false.

Is this a web set error?

I tried, cleared the cache, switched to private browsing mode, clearing the history. Still the same behavior.

+7
c # google-chrome safari back-button
source share
3 answers

I found the same problem with Chrome. Upon further testing, I found that this only happens if the website uses sessions. Whenever you click the back button, it deletes any post data instead of rearranging it.

I created a page to check it: http://www.duanehutchins.com/formtest.php If you enter some information and publish it several times, it works. Then press back and reboot; no data is transmitted.

If I disconnect the session, it works fine. I reported a Chrome error. We'll see if anyone helps.

+4
source share

We had a similar problem when the form data was β€œrestored” by Webkit, even though the page state changed on average.

A similar message Changes to Safari and Chrome settings are hidden back and represent the values ​​in the forms , giving good advice that worked for us. By adding autocomplete="off" to all the forms on the page, we could solve this problem.

+4
source share

See this example:

http://jsfiddle.net/eGutT/9/

This is happening to me. This seems like a pretty fundamental flaw, since the use case is so simple and most likely common. I have already encountered this problem in two places in different projects. If disconnecting the session actually fixes this problem, this is not a real fix, as most clients do not even know about this parameter or care.

0
source share

All Articles