定位到iframe的Firefox表单正在打开新选项卡 [英] Firefox form targeting an iframe is opening new tab
问题描述
< form method =posttarget =take_the_reload>
...
< / form>
< iframe class =hide_mename =take_the_reload>< / iframe>
我的问题如下:
我有一个表单,需要防止刷新提交时所在的页面。为了解决这个问题,我一直在为表单使用一个空的 iframe
作为 target
。这与Chrome(v12.0.742)中的预期完全相同,但在Firefox(v6.0)中失败。
Firefox中会发生什么情况,新表格提交后,这显然不是我想要的。
我发现一些 相关的 帖子,但没有解决我的具体情况,他们的解决方案不起作用。
不幸的是,这项工作是在一个私有网络的专有系统,所以我不能只是简单地提供一个链接。
我也尝试过使用 frame ,而不是
< form method =postaction =link / to / post / totarget =take_the_reload>
...
< / form>
< iframe id =take_the_reloadname =take_the_reload>< / iframe>
<form method="post" target="take_the_reload">
...
</form>
<iframe class="hide_me" name="take_the_reload"></iframe>
My issue is as follows:
I have a form that needs to be prevented from refreshing the page it is located on when it is submitted. To combat this issue, I have been using an empty iframe
as the target
for the form. This works exactly as expected in Chrome (v12.0.742) but fails in Firefox (v6.0).
What happens in Firefox, is that the iframe is opened in a new tab upon form submission, which is obviously not what I want.
I have found some related posts, but none address my particular situation and their solutions do not work.
Unfortunately, the work is on a proprietary system in a private network so I can not just simply provide a link.
I have also tried using a frame
as opposed to an iframe
as an answer to a related topic was that using iframe
s in such a manner is deprecated. But the results are identical.
Also the iframe
is hard-coded into the page in the sense that it is not dynamically added with JavaScript. Finally, like I said earlier, this works flawlessly in Chrome, but fails to work at all in Firefox. IE is not a concern and so any non-IE-friendly solutions are welcome!
This might sound stupid but did you try giving the iframe an id the same as the name attribute? This seems to solve some problems relating to forms.
<form method="post" action="link/to/post/to" target="take_the_reload">
...
</form>
<iframe id="take_the_reload" name="take_the_reload"></iframe>
这篇关于定位到iframe的Firefox表单正在打开新选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!