Ben
Ben

Reputation: 16660

Facebook Dialog Feed (display parameter not working)

I've followed the documentation to add Facebook feed dialog to my site. My one issue is that the dialog is not opening as a popup, even though I am setting the display parameter to "popup".

<a class="facebook_icon" href="http://www.facebook.com/dialog/feed?app_id=264179898666332&display=popup&redirect_uri=http://mysite.com/&message=I use Mysite!"></a>

I realize that, to display it as an iframe, I need to get user permission to obtain an access key. I just want to show the dialog as a separate window for the time being.

Any clue why this isn't working? Is the general consensus that I should just use the iframe now for UX's sake?

Upvotes: 2

Views: 12450

Answers (4)

Matthew Williams
Matthew Williams

Reputation: 285

According the Facebook documentation for "display modes" (https://developers.facebook.com/docs/reference/dialogs/), the "popup" attribute does not automatically create your popup for you, instead it just formats content on the page such that the content looks best in a 'popup'

They key wording is "For use in a browser popup no bigger than 400px by 580px". They are suggesting you use javascript to invoke a popup and format that popup no larger than 400 by 580

facebook_share_url = 'https://www.facebook.com/dialog/feed?app_id=' + window.settings_fb_key + '&link=' + merchant_url + '&redirect_uri=' + merchant_url + '&display=popup'
window.open(facebook_share_url,'','width=400,height=580')

Upvotes: 1

Parthi
Parthi

Reputation: 69

Use this code it works

FB.init({appId: "Your AppId",show_error:true, status: true, cookie: true}); 

  function postToFeed() { 

    // calling the API ... 
    var obj = { 
      method: 'feed', 
      link: 'https://developers.facebook.com/docs/reference/dialogs/', 
      picture: 'http://fbrell.com/f8.jpg', 
      name: 'Facebook Dialogs', 
      caption: 'Reference Documentation', 
      description: 'Using Dialogs to interact with users.' 
    }; 

    FB.ui(obj, callback); 
  } 

    function callback(response)  
{ 

    } 

Upvotes: 0

Andy
Andy

Reputation: 7826

I thought I had this issue for quite a while before I discovered that display=popup does not open the dialog as a popup, rather it formats the dialog so that it looks good in a popup.

I ended up using Javascript to open it in a new window - something like this:

window.open("http://www.facebook.com/dialog/feed?app_id=264179898666332&display=popup&redirect_uri=http://mysite.com/&message=I use Mysite!",
                            "My Window Name", 
                            "height=236, width=516");

You will notice that if you now switch the display between display=popup and display=page, the popup formatting looks much better than the page formatting if you're displaying it in a new window.

Upvotes: 6

ifaour
ifaour

Reputation: 38135

Something like:

<a class="facebook_icon" href="" target="_blank"></a>

Don't forget that you can always use the FB.ui method. Just go to the test console, click on examples and choose "feed" under "FB.ui":

var publish = {
  method: 'feed',
  message: 'getting educated about Facebook Connect',
  picture: 'http://fbrell.com/f8.jpg'
};

FB.ui(publish, Log.info.bind('feed callback'));

Upvotes: 0

Related Questions