Facebook JavaScript SDK: FB.ui opens a popup window

Umair Khan Jadoon picture Umair Khan Jadoon · Jul 30, 2011 · Viewed 26.2k times · Source

I am trying to show a 'Post to Your Wall' feed dialog with the following code in a facebook iframe app:

<div id="fb-root"></div>
  <script src="http://connect.facebook.net/en_US/all.js">
  </script>
  <script>
     FB.init({ 
        appId:'249725835046216', cookie:true, 
        status:true, xfbml:true 
     });

     FB.ui({ method: 'feed', 
        message: 'Facebook for Websites is super-cool',
        name: 'Facebook Dialogs',
        link: 'http://developers.facebook.com/docs/reference/dialogs/',
        picture: 'http://fbrell.com/f8.jpg',
        caption: 'Reference Documentation',
        description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'



        });
  </script>

The problem is that it is appearing in a new popup window like this:

enter image description here

Instead of appearing as like this without appearing in a popup window:

enter image description here

I don't want the feed dialog to appear in a new popup windows because in most modern web browsers where popups are blocked. I don't know why this is happening. Please help.

Answer

Brent Baisley picture Brent Baisley · Jul 30, 2011

I'm pretty sure that you get a popup if the user has not authorized your application. Facebook made it work that way for security reasons. If you prompt for authorization first, then you should get the inline dialog.

Note that the request for authorization will itself be a popup, but you only have to have that happen once. I have things working this way, the way you want, in the someecards Facebook app. Feel free to grab the javascript code, it's not specific to the app.