Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanwongbh/4328222 to your computer and use it in GitHub Desktop.
Save bryanwongbh/4328222 to your computer and use it in GitHub Desktop.
Javascript: Facebook Connect, Like and Comments
<!-- This is for fb connection javascript along with fb like button and fb comments for rails app especially posts -->
<!-- FB Connect javascript -->
<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=<YOUR_APP_ID>";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!-- FB Like button -->
<div class="fb-like" data-href="<%= post_url %>" data-send="false" data-width="450" data-show-faces="false"></div>
<!-- FB comments -->
<div class="fb-comments" data-href="<%= post_url %>" data-num-posts="5" data-width="670"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment