javascript - Facebook Like Button on Local Site -
i've taken on management of website, , have set local test instance of website can make changes slowly, test them etc, , move them over. without having risk integrity of live version. had convert few hrefs etc work locally, problem having facebook buttons no longer displaying.
i've read there issues way facebook caches our sites can cause issue, answer has been use facebook dubugger test site. can't because site local, , button working fine on live hosted version.
edit: clarify, have run social media buttons on local sites before, isn't problem. buttons not displaying on local test version.
below script using , div (i using facebook's html5 version);
<div id="fb-root"></div> <script type="text/javascript"> (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#xfbml=1"; fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script>
and here 1 of divs using mark buttons' position.
<div class="fb-like" data-href="http://www.4siteconsulting.co.uk/case-study-1.html" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false"></div>
the divs linked live site, because people can't local version.
anyone have thoughts?
although it's hardly satisfactory answer, have switched using html5 version facebook developers iframe version. iframe has fewer customization features, runs locally without issue after small adjustment.
i had append "http://" beginning of iframe href address work locally, it's working now. following code works on local site (not hosted);
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3a%2f%2fwww.4siteconsulting.co.uk%2fcase-study-2.html&send=false&layout=button_count&width=450&show_faces=false&font&colorscheme=light&action=like&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:21px;" allowtransparency="true"></iframe>
Comments
Post a Comment