If you’re building Facebook Page Apps, the platform offers a number of useful functions to help you out. The only problem is that some of these features are not well documented, or hard to find unless you know what to look for. Here is a list of useful functions and snippets of code I’ve used in the past for helping in developing Page Apps.
Adding Your Application to a Page
You can use the FB.ui method to trigger a Facebook Popup that lets you Install the application to pages you manage.
Removing the Page App Scrollbars
FB.Canvas.setAutoGrow(true); function call to the
window.fbAsyncInit function (like below) will remove those scrollbars by increasing the hight of the page to match your application.
If you get horizontal scrollbars showing up, make sure your application uses a maximum width of 810px. If you still see scrollbars, set the
hidden. Example below:
Scrolling within the Page App iFrame
Get Information About the iFrame
You can use this function to access information about the user’s browser size, the position of the iframe on the page, and the scroll position of the browse. You can then use this information to position popups or other elements so they are always in view of the user, for example, scrolling navigation.
Page App Likegate
If you want to lock down your application to user who’ve Liked your page, you can use the Facebook PHP SDK (or similar) to detect this. Luckily, I’ve already covered this functionality in a previous post.