Wednesday, November 6, 2013

Facebook Like button show on your webSite

1. The following snippet of code will give the basic version of the SDK where the options are set to their most common defaults. You should insert it directly after the opening <body> tag on each page you want to load it:


<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : 'FBAPPID',
      xfbml      : true,
      version    : 'v2.8'
    });
  };

  (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_US/sdk.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));
</script>
2. Add this code in your page where you want to show the like button

<div class="fb-like" data-href="https://www.facebook.com/wasam.arts" data-width="200" data-layout="standard" data-action="like" data-size="large" data-show-faces="true" data-share="true"></div>




Hope this helps.

No comments:

Post a Comment