开发者

Avoid form fields resetting when going back after following a link

开发者 https://www.devze.com 2023-03-22 10:58 出处:网络
I\'d like to make sure that after editing and then navigating away from a form (pressing Back or clicking a link) and returning (using the Back or Forward button), the form data is not reset. I have v

I'd like to make sure that after editing and then navigating away from a form (pressing Back or clicking a link) and returning (using the Back or Forward button), the form data is not reset. I have verified that this works on another web site. What do I need to check?

Before answering, please note that I'm not submitting and then going back. Simply following links a开发者_StackOverflownd then returning.

Context:

  • Firefox.
  • JavaScript is disabled in the browser.
  • The web site is on an intranet.
  • A proxy is used system-wide, but it connects directly on the intranet.
  • The web page is served over HTTP.
  • The markup is valid XHTML 1.0 Transitional.
  • The markup contains no frames.
  • The back-end language is PHP.
  • The web server is Apache.
  • The server is a custom Linux distro.


Most browsers cache form input values. So when user refreshes page, the inputs have same values.

You should check your code-behind for browser cache manipulations like:

<?
  Header('Cache-Control: no-cache');
  Header('Pragma: no-cache');
  ?>

and also your plain HTML-templates for:

<meta http-equiv="Expires" content="Tue, 01 Jan 2000 12:12:12 GMT">

or

<meta http-equiv="Pragma" content="no-cache">
0

精彩评论

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