0

I know this is supposed to be easy task and I have tried code from the developer sites of twitter and facebook as well but any of those code won't work. I also tried from some other sites as well.

I have to put facebook/twitter share buttons in my webpage.Both the codes from the developer site are not working when I check then on XAMPP .

<html>
<head> Vamos </head>
<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); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-share-button" data-href="https://developers.facebook.com/docs/plugins/"></div>
<a href="https://twitter.com/share" class="twitter-share-button" data-via="TinyNote1">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>

</body>
</html>

In above code in Chrome browser nothing except the head element gets displayed.

Could you please find what am I doind wrong and what should I do ?

I tried using XFBML (Add an XML namespace to the tag of your document.) but nothing worked for me.

Florentino
  • 117
  • 1
  • 1
  • 8
  • 1
    you need to explain how they are not working. Are the scripts not getting included, are there errors on the javascript console, are the share buttons not opening a popup for the share? – Patrick Evans Oct 23 '14 at 19:24
  • @PatrickEvans I edited my question. Please check . – Florentino Oct 23 '14 at 19:27
  • open the network tab (F12, click Network), reload the page are the scripts from twitter, facebook being retrieved? – Patrick Evans Oct 23 '14 at 19:31
  • @PatrickEvans I think network is fine, I am not having trouble in retieving any scripts for other pages. This thing is not working anywhere, http://www.compileonline.com/try_html5_online.php based on developer instructions at twitter facebook they say only this much code is required , i wonder what is wrong – Florentino Oct 23 '14 at 19:38
  • I just copied this code to my local and ran it on a local server and i am seeing the buttons as expected. I tested Safari v7.1, Chrome v. 38, and Firefox v33 - all for mac. Can you provide some other browser specs if you aren't using the latest builds? – Roger Oct 23 '14 at 19:39
  • @Roger Chrome 38 on Windows 8.1 but i have AD Block plus and ghostery chrome plugins installed could they be the reason ? Yes they are, I checked now. Still, after disabling them, I don't get the facebook button, Only tweet button is coming ? – Florentino Oct 23 '14 at 19:46
  • I just run the code and it works. [Check it out](http://jsfiddle.net/carlodurso/7pbr5fsq/). Definitely something wrong with your machine. Try disabling XAMPP. – carlodurso Oct 23 '14 at 19:47
  • @carlodurso In your link I wonder why isn't the facebook button working ? I have the code for facebook also. Could you say why it isn't working ? Thanks a lot. – Florentino Oct 23 '14 at 19:49
  • @carlodurso Are you also getting the Facebook button in your browser ? – Florentino Oct 23 '14 at 19:53
  • Looks like something wrong with facebook sdk. Locally I get this warning in the console: _fb:share_button failed to resize in 45s_ – carlodurso Oct 23 '14 at 20:07
  • not a problem. I'll let you know if I get it working. – carlodurso Oct 23 '14 at 20:19

1 Answers1

1

Florentino, I tested the Facebook social plugin on my server and it's working as expected. Same issue as the one described in this thread.

Community
  • 1
  • 1
carlodurso
  • 2,886
  • 4
  • 24
  • 37