Facebook Developers
DocsToolsSupportNewsApps
Log In
  • Social Plugins
  • Facebook Login
  • Open Graph
  • Facebook APIs
  • Games
  • Payments
  • App Center
  • Promote Your App
  • iOS
  • Android
  • JavaScript
  • PHP
  • More SDKs
  • Core Methods
    • FB.api
    • FB.init
    • FB.ui
  • Auth Methods
    • FB.getAuthResponse
    • FB.getLoginStatus
    • FB.login
    • FB.logout
  • Event Handling
    • FB.Event.subscribe
    • FB.Event.unsubscribe
  • XFBML
    • FB.XFBML.parse
  • Canvas Methods
    • FB.Canvas.Prefetcher.addStaticResource
    • FB.Canvas.Prefetcher.setCollectionMode
    • FB.Canvas.hideFlashElement
    • FB.Canvas.scrollTo
    • FB.Canvas.setAutoGrow
    • FB.Canvas.setDoneLoading
    • FB.Canvas.setSize
    • FB.Canvas.setUrlHandler
    • FB.Canvas.showFlashElement
    • FB.Canvas.startTimer
    • FB.Canvas.stopTimer

FB.ui

Overview

FB.ui is a generic helper method for triggering Dialogs which allow the user to take some action.

These dialogs include:

  • The Feed Dialog allows a user to post a story to their Timeline and to their friends' News Feeds
  • The OAuth Dialog allows a user to authorize an application as part of an authentication flow.
  • The Add Page Tab Dialog allows a user to add an application to a Facebook Page which they administer.
  • The Friends Dialog allows a user to send a friend request to another user.
  • The Pay Dialog allows a user to make a purchase using Facebook Credits.
  • The Requests Dialog allows a user to send a request to one or more of their friends
  • The Send Dialog allows a user to send a Facebook Message to one or more of their friends.

Example

To invoke the Feed Dialog, use feed as the method, and optionally specify other properties as documented in the Feed Dialog documentation:

FB.ui(
  {
    method: 'feed',
    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.'
  },
  function(response) {
    if (response && response.post_id) {
      alert('Post was published.');
    } else {
      alert('Post was not published.');
    }
  }
);

Parameters

NameTypeDescription
paramsObject

The required arguments vary based on the method being used, but specifying the method itself is mandatory. Please find the full list of dialogs that can be used as values for method in the Dialogs documentation. If display is not specified, then iframe dialogs will be used when possible, and popups otherwise.

Property Type Description Argument
method String The UI dialog to invoke. Required
display String Specify "popup" to force popups. See Dialogs docs for other display types. Optional
cbFunction

Callback function to handle the result. Not all methods may have a response.

Updated about 4 months ago
Facebook © 2013 · English (US)
AboutAdvertisingCareersPlatform PoliciesPrivacy Policy