I am not able to use Facebook Like and Share Butoon on my website
Anyone can help mee

<html>

<head>
</head>

<body>
<div id="fb-root"></div>
    <script>
      window.fbAsyncInit = function() {
        FB.init({
          appId      : 'app id',
          status     : true,
          xfbml      : true
        });
      };

      (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/all.js";
         fjs.parentNode.insertBefore(js, fjs);
       }(document, 'script', 'facebook-jssdk'));
    </script>
<div class="fb-share-button" data-href="http://gmail.com" data-width="100" data-type="button_count">

</div>
</body>

</html>

Recommended Answers

All 3 Replies

hi use your code and just put my app id fb. so it is sharing. i don't know what you want or may be fb app id you are putting is wrong.

`
i put both like and share in one html. put my app id it working. may help u.

<html>

<head>
</head>

<body>
<div id="fb-root"></div>

    <script>
      window.fbAsyncInit = function() {
        FB.init({
          appId      : 'put your fb aap id here create it from fb',
          status     : true,
          xfbml      : true
        });
      };

      (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/all.js";
         fjs.parentNode.insertBefore(js, fjs);
       }(document, 'script', 'facebook-jssdk'));
    </script>
<div class="fb-share-button" data-href="http://google.com" data-width="100" data-type="button_count"></div>

<div class="fb-like" data-href="http://www.google.com" data-send="false" data-layout="button_count" data-width="60" data-show-faces="true"></div>

</body>
</html>
<script type="text/javascript">
var sUrl = window.location;
document.getElementById('fb').setAttribute('href', sUrl);
</script>

`

i used like and share button both
with the same code
and share button is working fine
but when i use the like button
then it given** Error** and like button no loads again on the page..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.