form target iframe not working in IE7- in facebook fan tab

Posted by greatcaesarsghost on Stack Overflow See other posts from Stack Overflow or by greatcaesarsghost
Published on 2011-02-10T23:22:59Z Indexed on 2011/02/10 23:25 UTC
Read the original article Hit count: 174

Filed under:
|
|
|
|

This issue is similar to the one discussed in this thread, only mine is in a Facebook fan page tab (FBML/FBJS). The fix described in the referenced question works fine outside of Facebook, but for whatever reason I can't get it to work in the posted FBJS.

Here's a stripped down version of what I'm trying to do:

<script type="text/javascript">
function doit()
{
document.getElementById('msg').setInnerXHTML('<iframe id="testframe" name="testframe" frameborder="0"  />');
}
</script>


<div id="msg"></div>
<form action="http://somesite.com/whatever.php" method="post" id="testform" name="testform" target="testframe">
<input type="text" id="txt1" name="txt1" />
<input type="submit" id="btn" name="btn" value="test" onclick="doit();" />
</form>

--

This behaves as you'd expect in all browsers, except IE <= 7, where it opens a new window.

IE's dev tool shows the iframe as having a 'submitName' attribute, but no 'name' attribute. Even by manually setting the name (document.getElementbyId('testframe').setName('testframe') fails to work the way it would outside of Facebook.

Has anyone run into this same issue, and if so, is there any way around it?

Thank you.

© Stack Overflow or respective owner

Related posts about facebook

Related posts about iframe