Public Canvas Pages

From Facebook Developers Wiki

Jump to: navigation, search

Facebook now offers applications the ability to serve canvas pages to users not currently logged in to either Facebook or the application, or the user hasn't agreed to the Terms of Service for the application. This will afford your application greater exposure, a broader user base, and the ability to be indexed by search engines.

Contents

[edit] Wow, that's great! How do I enable it?

Public canvas pages are enabled for all applications by default. The big difference from the application's perspective is that the fb_sig_user parameter will not be passed to your application when the viewer is not logged in. This provides a simple way for you to know whether the person using your application is logged in or not.

If you use the PHP client library, simply use

$user = $facebook->get_loggedin_user()

To check whether the user is logged out, you may simply check

$is_logged_out = !$user;

If you do not wish to allow public canvas page, continue using

$user = $facebook->require_login()


[edit] Public Canvas URLs

Public canvas pages will use the same URLs that normal canvas pages do. For instance, if your application's page is http://apps.facebook.com/myapp/ then this same URL will be accessible to all people on the internet.

[edit] FBML Changes

Any tag allowed on a canvas page will work for public canvas pages as well. We have modified the privacy rules for some of the tags, the details of which are outlined below:

[edit] fb:if- Tags

All fb:if will render the fb:else block for logged out users.

[edit] Friend Selectors

Friend selectors render as a registration link that goes to your app-specific registration page. If the user registers through this page, he or she will automatically have your application added.

[edit] fb:name

fb:name will only render a user's first name. This is to protect our users from their full name being exposed to people that would not normally be able to see it.

[edit] fb:profile-pic

Profile pictures are allowed, but only if publicly searchable. If the user's profile picture is not publicly visible, then it will be replaced with a question mark to keep formatting consistent.

[edit] fb:is-logged-out

We have added the fb:is-logged-out tag for content specially designed for logged out users. For example:

<fb:is-logged-out> Please sign up to use this application with your friends. <fb:else> Welcome valued user! </fb:is-logged-out>