浏览器刷新后,IE表单输入数据消失 [英] IE form input data disappear after browser refresh

查看:894
本文介绍了浏览器刷新后,IE表单输入数据消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在没有PHP的情况下实现粘性表单。我的设置是像JavaScript一样的AJAX。在IE和FF上后退/前进工作正常,但刷新只适用于FF,而不是IE。无论我使用什么缓存选项,我甚至都设置了IE的临时文件选项,从不检查更新,并且在刷新页面(刷新按钮或F5)后,输入值不见了。



我读过许多帖子,人们有相反的问题,不希望表单数据在整个页面刷新过程中持续存在,也不会从浏览器缓存中读取,但我确实是这样。



任何帮助表示赞赏,谢谢!



ps。诸如 HTML - 刷新后保留的输入值与我的问题完全相反

解决方案

IE / Chrome / Safari / Opera / etc具有预期的行为。



我认为这是一个错误,当您点击刷新时FF实际上并未刷新字段。



After所有,刷新的目的是转储你已经从服务器重新加载。对于Firefox,然后将任何已更改的信息/字段合并到表单中是意想不到的行为,恕我直言,由设计不好。



另外请注意,这一个问题已经争取了在 Mozilla 10年。它是很多重复错误报告的来源,被许多人认为是一个严重的失败,而且很坦率地说是一个完整的PITA。我不知道有多少次我不得不向非技术人员解释为什么Firefox 重新加载按钮没有重新加载页面。

最近,我只是告诉他们Firefox重新加载按钮已损坏,他们必须按住shift键才能点击刷新或使用其他浏览器。幸运的是我们有选择。



---由于对F5和Ctrl-F5是什么造成混淆的评论而更新。 >
所有浏览器(Firefox除外)都将F5视为重新加载。这意味着如果缓存被禁用,则从缓存或从服务器重新加载页面。 Firefox不会重新加载,但它也会重新填充您输入内容的所有框......只要这些字段仍然存在即可。恕我直言,这是不好的行为,因为页面可能已经改变,并且最终处于非常无效的状态,其中一些事物被填充而另一些则没有。

要清楚,缓存不包含您在页面中输入的内容;缓存只包含服务器发送给您的内容。因此,Firefox本身需要尝试合并之前输入和未提交的数据。所有浏览器(包括Firefox)都将Ctrl F5视为从服务器重新加载。所有浏览器(包括Firefox)都将Ctrl F5视为从服务器重新加载。这会忽略任何已缓存的文件(图像,CSS,JavaScript等),并将其从服务器拉下来。值得庆幸的是,当您执行Ctrl-F5时,Firefox不会将未提交的数据合并回页面。


I'm trying to achieve sticky forms without PHP. My setup is AJAX like javascript. The back/forward work fine on both IE and FF, but refresh only works on FF, not IE. Doesn't matter what cache options I use, I've even set IE's temporary files option to never check for updates, and the input value is gone after page refresh(the refresh button or F5)

I've read many posts where people have the opposite problem, and do not want form data to persist across page refresh, and never read from browser cache, but I do.

Any help is appreciated, thanks!

ps. posts like HTML - input value kept after Refresh are exactly the opposite of my problems

解决方案

IE/Chrome/Safari/Opera/etc has the expected behavior.

I consider it a bug that FF doesn't actually refresh the fields when you click refresh.

After all, the purpose of the refresh is to dump what you have and reload from the server. For Firefox to then merge any changed information / fields back into the form is unexpected behavior and, IMHO, bad by design.

Also note that this one issue has been fought over at Mozilla for 10 years. It is a source of MANY duplicate bug reports, is considered by many to be a critical failure, and is quite frankly a complete PITA. I don't know how many times I've had to explain to non-techies why the Firefox reload button doesn't, well, reload the page.

Lately I've taken to just telling them that the Firefox reload button is broken and that they have to either hold down the shift key which clicking refresh or use a different browser. Thankfully we have choices.

--- Update due to a comment stating confusion as to what F5 and Ctrl-F5 are --
All browsers (except Firefox) treat F5 as "reload". Which means reload the page either from cache or from the server if cache is disabled. Firefox does do the reload, but it also repopulates any boxes with stuff you've typed in... Provided those fields still exist. IMHO, this is bad behavior as a page may have changed and you end up in a very invalid state with some things filled in and others not.

To be clear, the cache does not contain what you typed in the page; cache only contains what the server sent you. So Firefox itself takes this extra step of trying to merge previously typed in and unsubmitted data. Again, NONE of the other browsers do this and it is a source of much confusion.

All browsers (including Firefox) treat Ctrl F5 as "reload from server". This ignores any files you've cached (images, css, javascript, etc) and pulls it brand new from the server. Thankfully, Firefox does not merge unsubmitted data back into the page when you do a Ctrl-F5.

这篇关于浏览器刷新后,IE表单输入数据消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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