Quickest way to add Facebook Like Button on your SharePoint page

Facebook is everywhere. No one can deny the importance of Facebook’s social media┬ácapabilities.

If you want to add the Facebook Like button on your SharePoint pages then just paste the following code in a Content Editor Web Part and you will instantly get the Like button for that page. You do not need to hardcode the URL of your page as the given code automatically find it for you.

Just copy paste it and enjoy!

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<SCRIPT LANGUAGE="JavaScript">

      <!--
      {
       var url = location.href;
       var url_parts = url.split('?');
       var main_url = url_parts[0];
       var facebookLike="<fb:like href='" + main_url + "' show_faces='true' width='450' font=''></fb:like>"

       document.write(facebookLike);
      }
      // -->
</SCRIPT>

Share

8 thoughts on “Quickest way to add Facebook Like Button on your SharePoint page”

  1. hello, I cannot get the tips working on my SP2010…
    I paste the code on a content editor, but when I test the link it says:
    The url is not valid…
    do you know this error?

  2. Hi julien,
    To find out what is the issue, add the following line of code at line no. 10 above:

    alert(main_url);

    It will display the url and will give you the idea why you are getting the error.

  3. Hi,

    I put it in Contect Editor in web part, but it just show the code on the page. it does not display the like button….:(

  4. This is so cool but I have a problem. I keep getting warnings from IE and I have to click “Allow all Content to show” and then the page refreshes and when it comes back I have two like buttons. Can someone tell me what I’m doing wrong?
    Thanks.

  5. Hi Debprotim,
    I don’t get it what you mean by the source editer. Could explain more clearer? Or give an example of codes? Thank you very much:)

Comments are closed.

Share via
Copy link
Powered by Social Snap