0

我无法让 Facebook Like 按钮在 ASP.NET 页面上工作。我尝试使用 FB 开发人员工具生成代码以显示点赞按钮,也尝试使用 AddThis,但均无效。以下是我尝试过的事情:

1) 类似按钮生成器的FB生成,IFRAME风格

<html>
<body>
    <iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.illuminephotos.co.uk%2Fblog.aspx&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font=segoe+ui&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>
</body>
</html>

2) 类似按钮生成器的FB生成,HTML5风格

<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) 由 AddThis 生成(稍微修改了<%=...%>块以使其在 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>

在这两种情况下,1) 和 2) 在 localhost 上都能完美运行。我可以看到 Like 按钮,当我单击它时它会起作用。但在服务器上,什么都没有,Firebug 的网络控制台只显示“blog.aspx”的获取,没有别的。

在 localhost 3) 上也可以完美运行,我可以看到 FB、Twitter、G+ 和 AddThis 按钮。但在服务器上,只有 Twitter、G+ 和 AddThis,没有 FB。

我已经用谷歌搜索并搜索过,但我很难过。Facebook 在做什么,而 Twitter/G+ 却没有?有任何想法吗?它如何在本地主机上正常工作但在服务器上失败?

(我的测试网址是http://www.illuminephotos.co.uk/blog.aspx

4

2 回答 2

1

以下是我如何让它在我做过的网站上工作,包括 Firefox:

<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.mysite.com&amp;send=true&amp;layout=standard&amp;width=450&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font=tahoma&amp;height=80"
    scrolling="no" frameborder="0" style="border: none; overflow: hidden; 
    width: 450px; margin-top:30px; padding-left:2px;
    height: 80px;" allowtransparency="true"></iframe>
于 2012-02-28T01:33:31.623 回答
1

这是一个 Adblock Plus 问题。禁用它,它在 Firefox 中也可以正常工作。我想我有一些很久以前剩下的额外的反 Facebook 过滤器,该死的..

于 2012-02-28T07:24:26.867 回答