function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
TehNrdTehNrd 

Integrating with facebook a pain, Visualforce compiler gets in way.

Facebook has created a pretty slick javascript API that allows you to add Like buttons, Login buttons, and more. Yet there is one major problem with the force.com platform. This requires you to use custom facebook tags such as:

 

<fb:like href="http://developers.facebook.com/" width="450" height="80"/>

But when you try to save the page the Visualforce compilers interprets "<fb:" as the markup for a Visualforce component and throws an error:

 

Error: Unknown component fb:like

 

This makes it a pain to integrate force.com sites with facebook. This is actually a Visualforce issue but the really loser here is force.com sites and this is why I posted in the sites section.

 

Thanks,

Jason

Best Answer chosen by Admin (Salesforce Developers) 
TehNrdTehNrd

It would appear wrapping FBML tags in a div like this resolves the issue:

 

<div xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="something">
<fb:login-button></fb:login-button>
</div>

I have no idea if this is a hack or a legit solution but it works.

 

-Jason

All Answers

TehNrdTehNrd

It would appear wrapping FBML tags in a div like this resolves the issue:

 

<div xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="something">
<fb:login-button></fb:login-button>
</div>

I have no idea if this is a hack or a legit solution but it works.

 

-Jason

This was selected as the best answer
cloudcodercloudcoder

Facebook also allows you to use the tags in an iframe. This is how I have accomplished the same functionality in the updated Facebook toolkit (coming soon!):

 

<apex:component controller="FacebookSocialController">


<apex:attribute name="style" description="Style for component" type="String" required="false" 

default="border:none; width:450px; height:80px" />

 

  <iframe src="{!likeUrl}?href={!siteUrl}" scrolling="no" frameborder="0" style=""></iframe>

 

</apex:component>

TehNrdTehNrd

I think only some of the facebook components support iframe. Like definitely does:

 

http://developers.facebook.com/docs/reference/plugins/like

 

but I don't think login does:

 

http://developers.facebook.com/docs/reference/plugins/login

 

cloudcodercloudcoder

correct. I dont think login does. Activities and Recommendations certainly do :)

Bodhtree1Bodhtree1

Hi,

 

Can u Suggest me How to get the Details of the Community created in Facebook into salesforce using Visual Force and apex. Waiting for your Reply.

 

Thanks & Regards,

Vamsi

Mark beniMark beni

Sorry Jason the code you wirte in second comment not working for me. can you help me because i have simillar problem Unknown compont fb even i import Facebook SDF also in VF page but error still same.

 

Waiting for reply....