Mozilla Firefox窗体值在history.back上重置 [英] Mozilla Firefox form values reset on history.back

查看:143
本文介绍了Mozilla Firefox窗体值在history.back上重置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个PHP脚本。我有一个表单使用后的方法和行动到另一个页面。如果发生错误,我会在该目标页面上显示一条消息,并让用户通过触发 history.back(); javascript函数的链接返回。
因此,用户点击链接并返回到页面包括表单和用户输入的值应保持在输入。



他们留在Chrome,但失去了Firefox浏览器。有没有一种方法可以在所有使用历史记录的主流浏览器上保存DOM信息,或者唯一的方法就是使用像会话,cookies等缓存?

解决方案

您可以,而且我知道这很烦人,捕获您的POST数据,并将其变为SESSION变量,然后重新填充浏览器上的输入字段。



或者,您可以将表单提交给iframe并进行处理,或者使用ajax进行处理并根据结果触发新的页面加载或不加载。

I'm writing a PHP script. I've got a form uses post method and action to another page. If an error occurs, I show a message on that target page, and let the user go back via a link that triggers history.back(); javascript function. So user clicks that link and turns back to the page includes form and values entered by user should remain in inputs.

They stay on Chrome, but lost in Firefox. Is there a way to keep DOM information on all major browsers using history, or is the only way to do that is to use a cache like session, cookies, etc. ?

解决方案

You could, and I know it's annoying, capture your POST data and turn it into SESSION variables, then repopulate input fields on browser back.

Alternatively, You can submit the form to an iframe and process, or use ajax to process and depending on the result, trigger a new page load or not.

这篇关于Mozilla Firefox窗体值在history.back上重置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆