Safari and Chrome back button changes hidden and submit values in forms
Posted
by OverClocked
on Stack Overflow
See other posts from Stack Overflow
or by OverClocked
Published on 2010-03-03T18:25:03Z
Indexed on
2010/03/16
21:11 UTC
Read the original article
Hit count: 224
The following problem happens on both Safari and Chrome, so probably a WebKit issue.
Page A: a page that requires you to login to see, contains a form that has a type=submit button, with name=submit, and value=a
Page B: some other page
Page C: ask user to login page, contains a form with a type=submit button, with name=submit and value=c
User visits page A, then page B. Then idles and the user's login session times out. User hits back button to go back to page A. Browser redirects user to page C.
On Safari and Chrome, when C is rendered, the form on page C has the type=submit button, name=submit, but value shows up as "a".
If you reload while on page C, "c" appears as the value of the name=submit button.
The same problem appears with type=hidden input fields; when user hits back button, their values are also changed to some other value from some other form. Also, this problem also shows up w/o the redirect, with just submit then back. In this case the previous page renders with incorrect values for hidden and submit CGI variables.
So far the only fix I can come up with is use Javascript to reset the type=hidden and type=submit variable values, after page C loads, to make sure the values are correct. But that's not clean and universally applicable.
Short of WebKit fixing this error, has anyone ran into a better workaround?
Thanks.
© Stack Overflow or respective owner