Facebook Developers
DocumentationSupportBlogAppsLog In
  • Getting Started
  • Core Concepts
  • Advanced Topics
    • Dialogs
    • FQL
    • Internationalization
    • Ads API
    • Credits
    • Chat API
    • Legacy REST API
    • Legacy FBML
    • Legacy FBJS
    • Legacy Javascript SDK
  • SDK Reference
  • Tools
  • Dialogs
    • Add Page Tab Dialog
    • Feed Dialog
    • Friends Dialog
    • OAuth Dialog
    • Pay Dialog
    • Requests Dialog
    • Send Dialog

Add Page Tab Dialog

Advanced Topics › Dialogs › Add Page Tab Dialog

Overview

The Add Page Tab Dialog prompts the user to add an app to a Facebook Page that the user admins. This does not require any extended permissions.

JavaScript Example

The following simple JavaScript example demonstrates using the FB.ui method in the JavaScript SDK to use the Add Page Tab Dialog:

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:fb="https://www.facebook.com/2008/fbml">
  <head>
    <title>My Add to Page Dialog Page</title>
  </head>
  <body>
    <div id='fb-root'></div>
    <script src='http://connect.facebook.net/en_US/all.js'></script>
    <p><a onclick='addToPage(); return false;'>Add to Page</a></p>
    <p id='msg'></p>

    <script> 
      FB.init({appId: "YOUR_APP_ID", status: true, cookie: true});

      function addToPage() {

        // calling the API ...
        var obj = {
          method: 'pagetab',
          redirect_uri: 'YOUR_URL',
        };

        FB.ui(obj);
      }
    
    </script>
  </body>
</html>

Note that the above example assumes that the user is already logged in and has authorized your application.

Direct URL Example

You can also bring up the Add to Page Dialog by explicitly directing the user to the /dialog/pagetab endpoint:

https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID
&display=popup&next=YOUR_URL

The user will see a dialog that looks like the following:

Properties

app_id

Your application's identifier. Required, but automatically specified by most SDKs.

redirect_uri

The URL to redirect to after the user clicks the Add Page Tab or Cancel buttons on the dialog. Required, but automatically specified by most SDKs.

display

The display mode in which to render the dialog. This is automatically specified by most SDKs.

Updated about 3 months ago
Facebook © 2012 · English (US)
AboutCareersPlatform PoliciesPrivacy Policy