Facebook Developers
DocumentationSupportBlogAppsLog In
  • Getting Started
  • Core Concepts
  • Advanced Topics
  • SDK Reference
    • JavaScript SDK
    • PHP SDK
    • iOS SDK
    • Android SDK
  • Tools
  • Core Methods
    • FB.api
    • FB.init
    • FB.ui
  • Auth Methods
    • FB.getAuthResponse
    • FB.getLoginStatus
    • FB.getSession
    • FB.login
    • FB.logout
  • Event Handling
    • FB.Event.subscribe
    • FB.Event.unsubscribe
  • XFBML Methods
    • FB.XFBML.parse
  • Canvas Methods
    • FB.Canvas.Prefetcher.addStaticResource
    • FB.Canvas.Prefetcher.setCollectionMode
    • FB.Canvas.getPageInfo
    • 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

SDK Reference › JavaScript SDK › FB.ui

Overview

FB.ui is a generic helper method for triggering Dialogs that access the Facebook Dialog API endpoint.

These include:

  • Publishing a story to the feed

  • Prompting the user to add a friend

  • Prompting the user to authorize your application, or grant it permissions

  • Prompting a payment

  • Prompting the user to send an application request to a friend

  • Prompting the user to share a link

Example

To invoke the feed dialog, use the name of the dialog as the method and optionally specify other properties 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

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

Updated about a week ago
Facebook © 2012 · English (US)
AboutCareersPlatform PoliciesPrivacy Policy