Other Things to Consider

Thus far, we’ve covered most of the basic HTML techniques you need to consider when writing your Facebook application. In the following sections, we’ll cover a few more miscellaneous techniques and caveats that you will want to know as you are developing your app.

User IDs and FBML

User IDs supplied to FBML are 64-bit integers created by Facebook to identify each user. You might notice when you visit your Facebook profile that the URL is structured like this: http://www.facebook.com/profile.php?id=683545112.

The number after the id= is your Facebook ID. When planning your app, you may want to store this ID in a database for later reference. In MySQL, I use the BIGINT(20) data type to do this. You will want to find the equivalent for your database environment.

In addition to the ID, whenever there is a uid attribute in FBML, you can use the following identifiers in place of the actual ID of the user:

loggedinuser

Returns the Facebook ID of the user who is visiting the profile or canvas page on which your app is installed.

profileowner

Returns the Facebook ID of the user who has actually installed your app (the profile owner), not the visiting user.

Public Canvas Pages and SEO

By default, your application’s canvas page is publicly searchable by search engines and viewable by those not logged into Facebook. This makes it very important to ensure that your application’s canvas pages are tuned for Search Engine Optimization (SEO), so that others can use your app outside ...

Get FBML Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.