使用firefox发布/重定向/获取同一页面 [英] Post/Redirect/Get on same page with firefox
问题描述
当用户刷新并分别发送两次内容时,获取重新提交发布数据对话框的方法是在发布内容时通过javascript强制刷新页面。这似乎适用于webkit浏览器和IE,但不幸的是firefox无法正常工作。
My workaround getting the "Resubmit post data" dialog when users refresh, and respectively sending stuff twice, was to force a refresh on the page via javascript when content is posted. Which seemed to work in webkit browsers and IE but unfortunately firefox doesn't work that way.
问题是在发布后我需要将用户返回到同样的页面让我对使用post / redirect / get方法感到困惑,因为在那里描述需要提供另一个页面。即使我从php本身发送重定向标题,firefox仍然要求重新提交。任何人都可以建议我如何解决这个问题?提前谢谢!
The problem is that after the post I need the user to be returned to the same page which kinda confused me on using the post/redirect/get method since it is described there that another page needs to be supplied. Even if I send a redirect header from php itself firefox still asks about resubmitting. Can anyone suggest how I can solve this problem? Thank you in advance!
编辑:这是一些代码
if($_SERVER['REQUEST_METHOD']=="POST"){
$user->validateSettingsData($_POST, TRUE);
echo "<div class='win box10'>Changes saved, please wait..</div>";
header("Refresh: 2; url=");
exit();
}
推荐答案
您可以使用PHP重定向。例如:
You can use PHP to redirect. For example:
if (isset($_POST)) {
// processing the data
// ....
header('LOCATION: ' . $_SERVER['REQUEST_URI']); // <-- for dynamic URL
exit();
}
这篇关于使用firefox发布/重定向/获取同一页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!