<i id='eTUW5'><tr id='eTUW5'><dt id='eTUW5'><q id='eTUW5'><span id='eTUW5'><b id='eTUW5'><form id='eTUW5'><ins id='eTUW5'></ins><ul id='eTUW5'></ul><sub id='eTUW5'></sub></form><legend id='eTUW5'></legend><bdo id='eTUW5'><pre id='eTUW5'><center id='eTUW5'></center></pre></bdo></b><th id='eTUW5'></th></span></q></dt></tr></i><div id='eTUW5'><tfoot id='eTUW5'></tfoot><dl id='eTUW5'><fieldset id='eTUW5'></fieldset></dl></div>

  • <small id='eTUW5'></small><noframes id='eTUW5'>

    <tfoot id='eTUW5'></tfoot>

      1. <legend id='eTUW5'><style id='eTUW5'><dir id='eTUW5'><q id='eTUW5'></q></dir></style></legend>

          <bdo id='eTUW5'></bdo><ul id='eTUW5'></ul>

        防止返回按钮显示 POST 确认警报

        时间:2024-08-22
      2. <small id='Pmbho'></small><noframes id='Pmbho'>

        • <bdo id='Pmbho'></bdo><ul id='Pmbho'></ul>
          <legend id='Pmbho'><style id='Pmbho'><dir id='Pmbho'><q id='Pmbho'></q></dir></style></legend>
            <i id='Pmbho'><tr id='Pmbho'><dt id='Pmbho'><q id='Pmbho'><span id='Pmbho'><b id='Pmbho'><form id='Pmbho'><ins id='Pmbho'></ins><ul id='Pmbho'></ul><sub id='Pmbho'></sub></form><legend id='Pmbho'></legend><bdo id='Pmbho'><pre id='Pmbho'><center id='Pmbho'></center></pre></bdo></b><th id='Pmbho'></th></span></q></dt></tr></i><div id='Pmbho'><tfoot id='Pmbho'></tfoot><dl id='Pmbho'><fieldset id='Pmbho'></fieldset></dl></div>
            <tfoot id='Pmbho'></tfoot>

                    <tbody id='Pmbho'></tbody>

                  本文介绍了防止返回按钮显示 POST 确认警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个向网页提供一长串参数的应用程序,因此我必须使用 POST 而不是 GET.问题是当页面被显示并且用户点击返回按钮时,Firefox 会显示一个警告:

                  I have an application that supplies long list of parameters to a web page, so I have to use POST instead of GET. The problem is that when page gets displayed and user clicks the Back button, Firefox shows up a warning:

                  要显示此页面,Firefox 必须发送重复之前执行的任何操作(例如搜索或订单确认)的信息.

                  To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier.

                  由于应用程序的构建方式是返回是一种非常常见的操作,这对最终用户来说确实很烦人.

                  Since application is built in such way that going Back is a quite common operation, this is really annoying to end users.

                  基本上,我想按照这个页面的方式来做:

                  Basically, I would like to do it the way this page does:

                  http://www.pikanya.net/testcache/

                  输入内容,提交,然后单击返回按钮.没有警告,它只是返回.

                  Enter something, submit, and click Back button. No warning, it just goes back.

                  谷歌搜索我发现这可能是 Firefox 3 中的一个错误,但我想以某种方式得到这种行为,即使他们修复"了它.

                  Googling I found out that this might be a bug in Firefox 3, but I'd like to somehow get this behavior even after they "fix" it.

                  我想它可以通过一些 HTTP 标头来实现,但究竟是哪一个?

                  I guess it could be doable with some HTTP headers, but which exactly?

                  推荐答案

                  一种方法是将 POST 重定向到重定向到 GET 的页面 - 请参阅 在维基百科上发布/重定向/获取.

                  One way round it is to redirect the POST to a page which redirects to a GET - see Post/Redirect/Get on wikipedia.

                  假设您的 POST 是 4K 的表单数据.大概您的服务器对这些数据做了一些事情,而不是只显示一次然后将其丢弃,例如将其保存在数据库中.继续这样做,或者如果它是一个巨大的搜索表单,请在数据库中创建一个临时副本,几天后或在使用空间限制时基于 LRU 被清除.现在创建可以使用 GET 访问的数据表示.如果它是临时的,则为其生成一个 ID 并将其用作 URL;如果它是一组永久数据,它可能有一个 ID 或可用于 URL 的东西.在最坏的情况下,使用小 URL 之类的算法可以将大 URL 折叠成更小的 URL.重定向 POST 以获取数据的表示形式.

                  Say your POST is 4K of form data. Presumably your server does something with that data rather than just displaying it once and throwing it away, such as saving it in a database. Keep doing that, or if it's a huge search form create a temporary copy of it in a database that gets purged after a few days or on a LRU basis when a space limit is used. Now create a representation of the data which can be accessed using GET. If it's temporary, generate an ID for it and use that as the URL; if it's a permanent set of data it probably has an ID or something that can be used for the URL. At the worst case, an algorithm like tiny url uses can collapse a big URL to a much smaller one. Redirect the POST to GET the representation of the data.

                  作为历史记录,这种技术是 1995 年建立的实践.

                  As a historical note, this technique was established practice in 1995.

                  这篇关于防止返回按钮显示 POST 确认警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 file_get_contents 显示图像 下一篇:检查是否从 iOS 设备访问 PHP 页面

                  相关文章

                    • <bdo id='RbFfw'></bdo><ul id='RbFfw'></ul>
                    1. <i id='RbFfw'><tr id='RbFfw'><dt id='RbFfw'><q id='RbFfw'><span id='RbFfw'><b id='RbFfw'><form id='RbFfw'><ins id='RbFfw'></ins><ul id='RbFfw'></ul><sub id='RbFfw'></sub></form><legend id='RbFfw'></legend><bdo id='RbFfw'><pre id='RbFfw'><center id='RbFfw'></center></pre></bdo></b><th id='RbFfw'></th></span></q></dt></tr></i><div id='RbFfw'><tfoot id='RbFfw'></tfoot><dl id='RbFfw'><fieldset id='RbFfw'></fieldset></dl></div>

                      <small id='RbFfw'></small><noframes id='RbFfw'>

                      <legend id='RbFfw'><style id='RbFfw'><dir id='RbFfw'><q id='RbFfw'></q></dir></style></legend>

                      <tfoot id='RbFfw'></tfoot>