FB.ui

The method FB.ui() is used to trigger different forms of Facebook created UI dialogs. These dialogs include:

  • The Share Dialog allows someone to post a link or Open Graph story to their profile.
  • The Login Dialog allows someone to use Facebook Login to grant permissions to an app.
  • The Add Page Tab Dialog allows someone to add an app to a tab on a Facebook Page which they admin.
  • The Requests Dialog allows someone to send a request to one or more of their friends from a game.
  • The Send Dialog allows someone to send a Facebook Message to one or more of their friends.
  • The Payments Dialog allows people to purchase virtual items for your app.
  • The Go Live Dialog allows people to broadcast live streaming via Facebook from your app.

FB.ui(params, function(response))

Parameters

NameTypeDescription
paramsobjectA collection of parameters that control which dialog is loaded, and relevant settings.
function(response)functionThis specifies the function that is called whenever the UI dialog is closed, either by success, cancellation, or errors. The response object will depend on the dialog being used. Consult the relevant dialog’s own reference doc to see the response object that should be returned. Defaults to null.

Examples

Share Dialog posting a link:

FB.ui(

{

method: ‘share’,

href: ‘https://developers.facebook.com/docs/’,

},

// callback

function(response) {

if (response && !response.error_message) {

alert(‘Posting completed.’);

} else {

alert(‘Error while posting.’);

}

}

);

response.error_message only appears if someone using your app authenciated it with Facebook login.

FB.api
FB.login

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?