'FB.ui stream.publish in an iframe application shows a popup instead of an iframe dialog

I am trying to show a "share" dialog using the following code, but it is displayed as a new window. This is an iFrame application inside Facebook. Does someone know how to make it show the "share" in a standard FB dialog iframe and not a new window?

<script src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
  FB.ui({ method: 'stream.publish', message:'hello world'});
</script>


Solution 1:[1]

Try

FB.ui({display: 'iframe' method: 'stream.publish', message:'hello world'});

This would attempt to open a iframe. However, I haven't gotten it to load successfully. :(

Solution 2:[2]

It works for me in Chrome (and probably other non-IE browsers), but i never got it working in IE8. But the older Javascript API works.

Solution 3:[3]

in most of cases the popup will be open when the javascript is broken, otherwise it open like a facebox.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 David Li
Solution 2 Láďa Durchánek
Solution 3 Felipe Roberto