Reputation: 11957
I can't get a Facebook Like button to work on an ASP.NET page. I've tried using the FB developer tools to generate the code to display the like button, and also tried using AddThis, and neither work. Here are the things I've tried:
1) generated by FB like button generator, IFRAME style
<html>
<body>
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.illuminephotos.co.uk%2Fblog.aspx&send=false&layout=standard&width=450&show_faces=true&action=like&colorscheme=light&font=segoe+ui&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>
</body>
</html>
2) generated by FB like button generator, HTML5 style
<html>
<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_GB/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
} (document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like" data-href="http://www.illuminephotos.co.uk/blog.aspx"
data-send="false" data-width="450" data-show-faces="true" data-font="segoe ui"></div>
</body>
</html>
3) generated by AddThis (slightly modified with <%=...%>
blocks to make it work on ASP.NET)
<html>
<body>
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_facebook_like" <%="fb:like:layout"%>="button_count"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_button_google_plusone" <%="g:plusone:size"%>="medium"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4f4c14fd1002be4d"></script>
<!-- AddThis Button END -->
</body>
</html>
In both cases 1) and 2) work perfectly on localhost. I can see the Like button and it works when I click it. But on the server, there's nothing, and Firebug's Net console only shows a get for "blog.aspx", nothing else.
On localhost 3) also works perfectly, I can see the FB, Twitter, G+ and AddThis buttons. But on the server, it is only Twitter, G+ and AddThis, without the FB one.
I've Googled it and searched SO, but I'm stumped. What is Facebook doing that Twitter/G+ isn't? Any ideas? How can it work OK on localhost but fail on the server?
(my test URL is http://www.illuminephotos.co.uk/blog.aspx)
Upvotes: 0
Views: 1910
Reputation: 11957
It was an Adblock Plus problem. Disabled that and it worked fine in Firefox too. I think I have some extra anti-facebook filter leftover from a long time ago, damn..
Upvotes: 1
Reputation: 15253
Here's how I got it to work on a site I did, including Firefox:
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.mysite.com&send=true&layout=standard&width=450&show_faces=true&action=like&colorscheme=light&font=tahoma&height=80"
scrolling="no" frameborder="0" style="border: none; overflow: hidden;
width: 450px; margin-top:30px; padding-left:2px;
height: 80px;" allowtransparency="true"></iframe>
Upvotes: 1