Add Facebook Like and Share Button Code For Website

Get Your Facebook Like and Share Button Code to Embed on Website or Blog

Facebook is viral social media platform for sharing content and images. Sharing content on Facebook always bring generous amount of traffic towards website and blog. We always love to share our posts on Facebook platform, but it’s not always possible for us to share our posts regularly on various Facebook users wall.

[Responsive]

By putting Facebook Like and Share buttons on each of our contents are a prodigious technique to allow reader to share our content on their wall and other wall. Sharing one content is visible to millions of users to Facebook. Most of the website now days generate 50 Percent of traffic from social media only and Facebook has the bigger numbers as compares to other social media website.

GenronTech Header-Cartoon

How to Use Facebook JavaScript SDK and Plugin Code

Adding Social Media Button for content sharing is very easy and pair of minute’s effort. We don’t required any technical skill for performing this task. For doing this, first we have to load Facebook SDK Code in our page so that the sharing button can be enable on our page.

[ResponsiveRect]

I have given all working steps please follow Bellow.

1. Load your Javascript SDK in your web page

To start adding your Facebook like and share button, we required to Embed Facebook SDK Code in our website source code. Copy and Paste given JavaScript Code in your Web pages within <Body> tag. This is the javascript function to display Facebook Like and Share Button into your web pages.

<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_US/sdk.js#xfbml=1&version=v2.4";
  fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));</script>

 

 

Add Plugin Code For Like and Share Button

Add your plugin code in place where you want to display your Facebook Like and Share Button. Replace the line “Your-like/share-URL” with your URL.

<div class="fb-like"  data-href="[Your-Like/share-URL]"  data-layout="standard" data-action="like"  data-show-faces="true" data-share="true"></div>

 

 

Add Plugin Code for Share Button

Add your plugin code in place where you want to display your Facebook Share Button. Replace the line “Your-like/share-URL” with your URL.

<div class="fb-share-button" data-href="[Your-Like/share-URL]" data-layout="button_count"></div>

 

 

3. Upload Your Web Page and Test the Given Code

Please check the result page after adding your Facebook Share and Like Button to your Facebook contents.

I have uploaded one result page do check. Check Here.

Read: How to Add Facebook Comment Box to HTML Website

Read: Embed Facebook Video on WordPress and Websites pages

2 thoughts on “Add Facebook Like and Share Button Code For Website”

Leave a Comment