Tuesday, May 15, 2012

Create a facebook apps and page tab

go to facebook developers area for apps: https://developers.facebook.com/apps
create a app.
set app display name
set app namespace
click tab app on facebook, give a url to view the page under apps home page, as iframe
select page tab and give your site url to visit from facebook apps as facebook iframe
get app id and secret from the app page
done,

Configuring a Page Tab

In order to enable this feature, you need to specify a Page Tab Name and a Page Tab URL (much like you provided a Canvas Page and Canvas URL previously) that is loaded when the user selects your Tab on a given Facebook Page. You must also specify aSecure Page Tab URL which is the HTTPS address of your content. Users browsing Facebook who have HTTPS enabled will be unable to use your tab if this URL is empty. Note that SSL support for your page tab app has been mandatory since October 1, 2011.
You can find these settings in the "Basic" section of your app's settings in the Developer App under 'Select how your app integrates with Facebook'. Click 'Page Tab' to expand the Page Tab settings, and the Page Tab fields will appear

Page Tab Width

The amount of space available to your tab app is bounded by the outer context of Facebook. It may be configured to display with a width of 520 pixels (default) or 810 pixels.

Adding an App to a Page

As a Page Tab App developer, you can prompt users to install your Page Tab App by including an "Install this Page Tab App" link that explicitly directs the user to the /dialog/pagetab endpoint, either within your Page Tab App or Website:
https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&next=YOUR_URL
where YOUR_APP_ID and YOUR_URL can be found in your app settings.
This URL brings up the Add to Page Dialog:


Integrating with Facebook APIs

When a user navigates to the Facebook Page, they will see your Page Tab added in the next available tab position. Broadly, a Page Tab is loaded in exactly the same way as a Canvas Page. Read more about this in the Canvas Tutorial. When a user selects your Page Tab, you will receive the signed_request parameter with one additional parameter, page. This parameter contains a JSON object with an id (the page id of the current page), admin (if the user is a admin of the page), and liked (if the user has liked the page). As with a Canvas Page, you will not receive all the user information accessible to your app in the signed_request until the user authorizes your app.
In addition, your app will also receive a string parameter called app_data as part of signed_request if an app_data parameter was set in the original query string in the URL your tab is loaded on. It could look like this: "https://www.facebook.com/YourPage?v=app_1234567890&app_data=any_string_here". You can use that to customize the content you render if you control the generation of the link.

1 comment: