share site on facebook

Posted on 2012-08-20
Last Modified: 2013-11-19

I want to place the Facebook icon on my website, so the visitors could share it.

I placed the codes and it is not working.

please can someone help me?

under body:

<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); = id;
  js.src = "//";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-like" data-href="" data-send="true" data-width="450" data-show-faces="true"></div>
Question by:Romacali
    LVL 52

    Expert Comment

    by:Scott Fell, EE MVE
    Check out it will make your life easier.
    LVL 18

    Accepted Solution

    This code works for me:

    <div id="fb-root"></div>
                          <script src=""></script>
                          appId : 'YOUR APP ID',
                          status : true, // check login status
                          cookie : true, // enable cookies to allow the server to access the session
                          xfbml : true, // parse XFBML
                          channelUrl : '', // channel.html file
                          oauth : true // enable OAuth 2.0
                          <fb:like class="fb" href="" layout="standard" show-faces="false" width="225" height="60" action="like" colorscheme="light" />

    Author Comment

    I tried the code below, the problem is that it shows the like button and how many likes it if I'm logged in Facebook.

    I want the Share on facebook, that display even if you are not logged in. When you click it would open a new window to login on FB and then you could share the page/site

    any tip?
    LVL 18

    Expert Comment

    While it is the like button, it shows the number of likes regardless of your login status. Clicking it does prompt you to log into Facebook if you are not already.

    Author Comment

    I've requested that this question be deleted for the following reason:

    yes===delete because i got it to work
    LVL 18

    Expert Comment

    This is a good resource for other EE users. While the code may not be exactly what worked for the asker it may assist others. Perhaps it will be better PAQed.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Currently, it's non-trivial for users to draw the attention of a particular Expert. Let's make it easier for them! You can set up a Saved Search with email notification so that you receive an email when a user mentions your name in their question…
    Follow these tips to boost your freelancing career. Soon enough you'll be enjoying the freedom of being your own boss and working from anywhere.
    Viewers will learn how to use the Hootsuite Dashboard.
    The goal of the tutorial is to teach the user how to block contacts and manage the block contact list.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now