问题描述
我想我有一个简单的问题,我还没有找到正确的答案,但thoguh。我的页面中有一个来自外部域的iframe。在提交了这个iframe中的表单之后,我想重定向整个页面,而不仅仅是iframe中的内容 - 我想通过target属性可以实现正确的方式。
示例html:
< html>
< body>
< h1>主页< / h1>
< iframe src =http://example.com>
< form url =http://example.com/action>
...
< / form>
< / iframe>
< / body>
< / html>
提交表单应显示提交POST请求作为新页面的结果(不在iframe)
我已经将 target ='_ parent'
iframe,但我最初并没有在表单
元素中完成此操作。将 target ='_ parent'
属性添加到表格
后,它开始按预期工作。
i guess I have an easy question, I have not found the right answer yet thoguh.I have an iframe in my page that comes from external domain. After submiting the form which is inside this iframe, I would like to redirect the whole page, not just content inside the iframe - i guess the right way to achieve might be via "target" attribute.
The sample html:
<html>
<body>
<h1>main page</h1>
<iframe src="http://example.com">
<form url="http://example.com/action">
...
</form>
</iframe>
</body>
</html>
submitting the form should show me the result of submiting the POST request as a new page (not in the iframe)
I have put target='_parent'
in the iframe but I haven't done this initially in the form
element. After adding target='_parent'
attribute to form
it started to work as expected.
这篇关于在iframe中提交表单并重定向整个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!