Ranveer
Ranveer

Reputation: 6871

How to make a Facebook app that installs a page tab on the user's page (of which he is the admin)?

I have made a simple Facebook app that takes in user data and does something (irrelevant to the question). Now, what I want is that the app must get installed on a user's page (i.e., the page for which the user is an admin) like this:

The app installed on the page

Here is the app that does the above.

How can I do this for my app? Is there something available with the Facebook API? Or is it a hack?

Upvotes: 1

Views: 894

Answers (1)

Malcolm
Malcolm

Reputation: 784

To add an app as a page tab you could try one of the following.

Tab Dialog using the JavaScript SDK.

<script type="text/javascript">
  function addtab()
  {
FB.ui({
  method: 'pagetab',
  redirect_uri: 'YOUR_URL'
}, function(response){});
  }
</script>

  <a href="#" onClick="addtab()">Add As Page Tab</a>

The above example assumes that the person has already logged in to your app.

URL Redirect.

<a href="https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&redirect_uri=YOUR_URL">Add As Page Tab</a>

Or like in your example website you could use something like the following.

<a href="https://www.facebook.com/add.php?api_key=YOUR_APP_ID&pages">Add As Page Tab</a>

Make sure and change YOUR_APP_ID and YOUR_URL with the ID and URL of the app you want to add as a Page Tab.

https://developers.facebook.com/docs/reference/dialogs/add_to_page

Upvotes: 1

Related Questions