javascript - Clicking the like in the website should like in Facebook - Stack Overflow

from here i got that code and i placed in my website localhost but cannot able to see any change .Can a

from here i got that code and i placed in my website localhost but cannot able to see any change .Can anyone help me this i got the code from here / My code is like this

<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/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-like" data-href=".shows" data-send="true" data-width="450" data-show-faces="true"></div>

from here i got that code and i placed in my website localhost but cannot able to see any change .Can anyone help me this i got the code from here http://developers.facebook./docs/reference/plugins/like/ My code is like this

<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/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-like" data-href="http://www.facebook./anicrave.shows" data-send="true" data-width="450" data-show-faces="true"></div>
Share Improve this question edited Oct 5, 2012 at 10:10 Gerald Schneider 17.8k10 gold badges63 silver badges79 bronze badges asked Oct 5, 2012 at 9:57 SivaShankerSivaShanker 231 gold badge1 silver badge4 bronze badges 2
  • Did you include the SDK on your page? developers.facebook./docs/reference/javascript – Rob Commented Oct 5, 2012 at 9:59
  • This is sdk right, i have already included code<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/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>code – SivaShanker Commented Oct 5, 2012 at 10:03
Add a ment  | 

1 Answer 1

Reset to default 2

Please check this link and add the references to your page. http://developers.facebook./docs/reference/javascript/

You're missing an essential part for FB-SDK in order to display the expected results.

    <div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : 'YOUR_APP_ID', // App ID
      channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      xfbml      : true  // parse XFBML
    });

    // Additional initialization code here
  };

  // Load the SDK Asynchronously
  (function(d){
     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook/en_US/all.js";
     ref.parentNode.insertBefore(js, ref);
   }(document));
</script>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745285556a4620537.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信