Best Way For Back Button To Leave Form Data

后端 未结 3 1781
迷失自我
迷失自我 2021-01-06 08:16

I\'m creating a web page based on user input from a form. After the user sees the generated page I want to allow them to press the back button and make changes to the form.

3条回答
  •  不要未来只要你来
    2021-01-06 09:09

    Store the saved information in cookies as delimited data. If the cookie exists, repopulate the form.

    If you use document.formName.fieldName syntax, there are no cross-browser issues.

    As a fall-back if cookies are disabled, you can store it on the server and do the same with AJAX.

提交回复
热议问题