Goodbye Static FBML, Hello iFrame – An Overview of Custom Tabs for Facebook Pages

Facebook has recently upgraded Pages with a raft of new features that are aimed at helping Page owners communicate more effectively.  Amongst the new features are better ways to keep up with activity on a Page, new ways for Pages to share content, new ways for users to filter a Page’s content by relevancy and a completely new system for creating Custom Tabs.

I’ve been looking into what these updates mean for businesses and app designers and have found that the new iFrame system opens the door to bigger and better Custom Tabs.

The New Custom Page

The most obvious change has been the design, with tabs being removed from the top to under the profile image and photos uploaded to the Page being displayed across the top in the same way as a normal Facebook Profile.  Additionally, it is now possible for admins to browse Facebook as a Page, increasing the ability for the Page to build a presence through liking, commenting and sharing content across the network.

The not so obvious change is in the way that Custom Tabs can be added.  Previously it was possible for a user to create a Tab using the Static FBML application and this was a really simple way to get a personalised tab that could act as the opening view of your Page.  FBML offered ways to access features of Facebook, including the like button and comments, as well as ways to use data about the user to customise content for them.  A fan gate was a typical feature where different content was shown to users who had liked a Page to those who hadn’t.

I’m talking about FBML in the past tense because that functionality has all changed, and from tomorrow (12th March 2011) you are no longer able to add a Static FBML tab to your Page.  Instead, Facebook has introduced iFrame support to Pages and Custom Tabs can only be created using that feature.

How to add a Custom Tab

So how do you go about building a Custom Tab using iFrame Applications?  The good news is that the new system is actually much better in terms of functionality that can be provided and once familiar with the process it is really simple.

A Custom Tab is setup in the developers area of Facebook in the same way that applications are created.  You specify a base url for your Canvas Application and then specify the url that tab content should come from.  Currently you have to specify a Canvas URL, even if you only want to use the Custom Tab feature.

Development and testing is easier as you can build your application locally and use exactly the same code to power the live application, no need to copy and paste FBML/HTML into a form on Facebook before clicking to preview.  An extra little benefit is that because you host the content, not Facebook, the aggressive caching that Facebook employed for Static FBML tabs is now no longer used, so no more having to put query strings on css and image urls when you need to make a change!

With the Javascript SDK and various server-side SDKs (typically I use the PHP SDK to access features of the Graph API) it is now possible to build your application using the same HTML, CSS and Javascript that you use on your own website.  This means that libraries such as jQuery and MooTools can be used to provide extra functionality to your custom Tab.

iFrame Apps Technical Details

Facebook sends POST data to your application when a user clicks to view your Custom Tab (they call this the Signed Request).  Depending on where your application is being viewed, the Signed Request includes information about the Page and the User.  If you haven’t requested extra permissions, there is only limited data about the User available, including their country, locale and ID.

For Custom Tabs the signed request contains extra information about the Page, including a boolean that says whether a user has liked the page or not.  This feature is what allows fan gates to be implemented as it provides a way to check a user’s status without having to request advanced permissions.  You can also detect whether the user is an admin of the page.

The migration from FBML to iFrame tabs has also meant the demise of preload FQL.  As with currently built static FBML tabs, any apps that make use of preload FQL currently will continue to work, but new apps will not be able to use this functionality.

Custom Tab Gotchas

The need to implement Custom Tabs through iFrame apps has also introduced some interesting gotchas that application developers and Page admins need to take into consideration.  The main one being that all applications, even when not submitted to the Application Directory, have a publicly available profile page.  Whether this profile page is advertised or not there are ways to find it, and trust me that users will, so updates and administration will need to be factored into the management of the Custom Tab.

Another potential source of issues is that a Canvas Application will exist for all Custom Tabs.  What content, if any, is shown there is a point for discussion between developers, designers and the Page admins, however it is worth remembering that a Canvas Application doesn’t get the extra Page data in its signed request, so any Page specific functionality needs to be removed.

Finally, it is worth remembering that apps can be installed on any Page, not just the ones that you administer, so it is important to plan what should happen if the app is installed away from your control.  Typically I suggest using that installation as an advert that directs users back to the Page for which the Custom Tab was created, but that certainly isn’t the only way to handle that situation.

Expanding Your App

This move by Facebook to remove Static FBML apps will inevitably lead to developers and businesses becoming more aware of the Graph API and the structure of applications both on and off Facebook as opposed to simply knowing how to have a custom design installed on their Page.  I also think it will help Facebook spread the usage of the Open Graph as businesses will now have applications that they can use to administer their Open Graph pages.

With the iFrame content being served from 3rd party servers it is possible to build Facebook support into a central CMS.  This could open the door to much greater control and use of Facebook Pages as content can be managed and updated a lot more easily than was previously possible using Static FBML. Showcasing a particular product on your Page could now be as simple as changing an image and some text in your CMS.

Of course, this is merely scratching the surface of what is possible, and I’m sure that in the coming months we shall see a wave of innovative uses of iFrame applications that weren’t previously possible using the Static FBML app. On the flip-side, there will be people that don’t want to move to the new iFrame system and apps are already popping up that replicate the functionality that was offered by Static FBML.

More Information

Extra details about the changes to Pages and the migration from Static FBML to iFrame apps can be found on Facebook:

 


Posted: March 11th, 2011 | Filed under: General | Tags: , ,
  • Shahid

    hi this is nice article, do you know how to detect non fans on iframe tab page?

  • Ian Thomas

    Hi Shahid,It’s a pretty straightforward process to find out whether someone is a fan or not. When your content is loaded by Facebook it has a signed-request sent as POST data. If you follow the instructions in the developers area of Facebook (http://developers.facebook.com/docs/authentication/signed_request/) you can get a variety of information, including whether or not the user has liked the page.To get started I’d suggest decoding the signed-request and then using var_dump() to see that various elements that are included.Hope that helps!

  • Shahid

    hi, thanks for you quick reply :) i tried this but not working in iframe modei used var_dump($_REQUEST); to get signed_request here https://www.facebook.com/pages/Shahid/112659332140449?sk=app_241534243458  (plz see attched files) but i am getting below reponce array(2) { ["__utmz"]=> string(112) "132645648.1301633511.3.3.utmcsr=apps.facebook.com|utmccn=(referral)|utmcmd=referral|utmcct=/ibm_photocontest_sg/" ["__utma"]=> string(55) "132645648.1400971134.1300738156.1301632699.1301633511.3" } i was using below code in fbml mode and was working fine<fb:visible-to-connection>Fans will see this content.<fb:else>Non-fans will see this content.</fb:else></fb:visible-to-connection> i want to know that any use that is on profile tab has liked the tab or not in iframe modeis authorization required to know about the user has liked the page or not?  <fb:visible-to-connection> was working without any authorization. plz helpthanks,Shahid

  • Shahid

    hi, i can see signed_request on application pagehttps://apps.facebook.com/shahidmau/but can not see on profile tab, i want to know it on profile tabthanks

  • Ian Thomas

    Hi Shahid,You’re almost there! You specifically need to get the signed_request from the POST params. Something like the following should get you nearly there…list($encodedSig, $payload) = explode(‘.’, $_REQUEST['signed_request'], 2);$sig = base64_decode(strtr($encodedSig, ‘-_’, ‘+/’));$data = json_decode(base64_decode(strtr($payload, ‘-_’, ‘+/’)), true); $expectedSig = hash_hmac(‘sha256′, $payload, $appSecret, $raw = true);if($sig != $expectedSig){ return false; //something isn’t right here so I normally stop processing}else{ //do something with the $data as everything is ok}Typically to see if someone likes the page you can then simply check a boolean in the $data variable like so:if($data['page']['liked']){ //user likes the page}else{ //user is not a fan}Hope this helps.

  • Ian Thomas

    If the signed request isn’t coming through on your iFrame tab then something is probably not quite setup properly in the application configuration. Just have a check through your application settings to make sure that everything is ok.

  • Shahid

    hi, thanks againits still not working on profile tabplz see screenshots

  • Ian Thomas

    I’m afraid you can’t post screenshots in the comments here, but I’ve seen your page and can see that the array is empty. I’d honestly suggest you double check your application settings in the http://www.facebook.com/developers area as it is unusual that you aren’t getting the signed_request. It is sent by default to all iFrame tabs so if you are still having trouble later I’d suggest you get in touch with someone from Facebook to see if you can find the cause!Good luck!

  • Shahid

    hi, screenshots are at below locationhttp://smsread.com/test/7.jpghttp://smsread.com/test/6.jpgplz check, if all settings are ok

  • Ian Thomas

    Try turning off Canvas Session Parameter (deprecated)

  • Shahid

    i tried by turning off Canvas Session Parameter (deprecated)but still not able to get signed_request :( i am so upset… i will try some other timethanks for your precious support :)

  • Pingback: Facebook comments iframe does not load more | User25