Firefox Form Targeting an Iframe Is Opening New Tab

Firefox form targeting an iframe is opening new tab

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>

Form targetting an iframe is opening new tab in Chrome

Remove the iframe from your html and try doing like this:

//Create the iframe, set its attributes and append it before the form
var iframe = document.createElement('iframe');
iframe.name = 'my_frame';
iframe.id = 'my_frame';
iframe.width = '400';
iframe.height = '700';
var form_element = document.getElementById('my_form');
form_element.parentNode.insertBefore(iframe, form_element);

//Submit form to iframe
document.getElementById('my_form').submit();

Form targeting iframe not working in FireFox

You may be facing the issue reported here: Firefox form targetting an iframe is opening new tab tl;dr: try adding an "id" attribute to the iframe, with the same value as the "name" attribute, and see if it resolves your problem.

Firefox submits form targetting iframe in new tab

The problem was the src attribute that was set to about: none;. This caused unexpected behavior.

Targetting Iframe with Form causes new window to open

Read here: http://terminalapp.net/submitting-a-form-with-target-set-to-a-script-generated-iframe-on-ie/
Indeed, after I switched to this:

 $('<iframe name="iframeUploader"/>').appendTo('body').attr({'id': 'iframeUploader'});

it worked. Tried it in IE8 and FF3.6

iframe opens in new tab

It seems that the problem was caused by having another tab open with the same url. When I closed 1 tab, it worked fine again.

Reloading iframe instead opens new tab - Firefox 21.0

Try binding to the click event instead:

HTML

<a href="#" id="repair"">↺ Repair</a>

Javascript

$('#repair').click(function(e){
var pl=$('#player iframe')[0];pl.src=pl.src;
return false;
});


Related Topics



Leave a reply



Submit