How to enable commenting on the Facebook Like Button
I'm integrating the Facebook Like Button into a site. The likeing functionality is working fine except that you cannot add comments to your like after you've clicked the like button. Several sites including CNN has this working so this开发者_StackOverflow should be possible.
The docs mention that you need to use the JavaScript SDK to get commenting to work, which I am doing; however I cannot get commenting to show up.
A fuller-featured Like button is available via the XFBML tag and requires you use the new JavaScript SDK. The XFBML version allows users to add a comment to their like as it is posted back to Facebook.
I cannot find details on which options are available for this more "fully-featured" XFBML like button.
I'm wondering if there is a setting that I need to add, an option that I'm not passing in, or anything that I've overlooked.
I am on a dev server, and I'm linking back to the live site for now. Perhaps the ContactURL and the base URL of the liked page need to be the same in order to get commenting to work?
Here's how I'm embedding the facebook like button:
<!-- facebook -->
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: 'XXXXXXXXXXXXXX', status: true, cookie: true, xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<!-- facebook -->
...
<fb:like href="example.com" layout="button_count" show_faces="false" width="100" colorscheme="dark"></fb:like>
You need to make sure that the "connect url" for your appid matches the domain you're putting the like button on. To do this, go to the "Edit Settings" page, and in the "Connect" section of the settings, fill on your "Connect URL".
Facebook's documentation never mentions this.
精彩评论