Reputation: 38062
Is it possible to use a Facebook Face Pile pointing to an APP-ID instead of a HREF through the JavaScript API? For example, what would the JavaScript equivalent of the iFrame code:
<iframe src="http://www.facebook.com/plugins/facepile.php?app_id=120600291315567"
style="border:none; overflow:hidden; width:300px; height: 70px">
</iframe>
Upvotes: 3
Views: 4079
Reputation: 3485
To show how many friends are using your website/app, just use the HTML5 example generated at https://developers.facebook.com/docs/reference/plugins/facepile/ and then remove the data-href
attribute. Example:
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId= 120600291315567";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-facepile" data-width="200" data-max-rows="1"></div>
The data-href
attribute signifies that you want to show how many people have liked that specific URL instead.
Upvotes: 7
Reputation: 162
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId= 120600291315567";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-facepile" data-href="http://example.com" data-width="200" data-max-rows="1"></div>
this actually shown in the social plugin docs in facebook.
Upvotes: -2