【发布时间】:2012-04-04 08:53:57
【问题描述】:
我正在使用此处提到的表单帖子加载带有一些帖子数据的 iframe:
一切正常。 但是,如果我的 iframe 网址中有重定向(通过标头或 javascript sn-p), 它不会重定向到 iframe 中的下一个 url,而是重定向父窗口。
例如:发布到 iframe 中:
<form action="do_stuff.aspx" method="post" target="my_iframe">
<input type="submit" value="Do Stuff!" />
</form>
<!-- when the form is submitted, the server response will appear in this iframe -->
<iframe name="my_iframe" src="not_submitted_yet.php"></iframe>
not_submitted_yet.php:
<?php
// DO some stuff with post data
// redirect to a success url
header("Location: THE_URL");
?>
问题是 THE_URL 没有在 iframe 本身中打开,而是在完整的浏览器窗口中打开,这是不受欢迎的行为。 我怎样才能解决这个问题 ? Firefox 和 chrome 中的行为是相同的。
【问题讨论】:
标签: php javascript iframe