【问题标题】:Facebook Like Button for a Facebook videoFacebook 视频的 Facebook Like 按钮
【发布时间】:2011-04-06 16:08:21
【问题描述】:

今天,我在我们的 Facebook 页面上创建了一个 iframe-Tab 作为登录页面。 在此选项卡上,我们显示了一个从 Facebook 实现的视频。

现在我想在这个页面上为这个视频添加 Facebook Like Button,我实现了 LIKE BUTTON 开发者页面生成的代码。

<iframe src="https://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fvideo%2Fvideo.php%3Fv%3D345848348745&layout=button_count&show_faces=true&width=100&action=like&font=arial&colorscheme=light&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:120px; height:21px;" allowTransparency="true"></iframe>

现在显示的按钮,但没有计数。 如果我点击like按钮,计数器会变得可见(显示+1)然后跳回来(不显示计数)。

你知道,如果我可以直接对 Facebook URL 使用点赞按钮吗? http://www.facebook.com/video/video.php?v=345848348745

谢谢你!

【问题讨论】:

    标签: facebook iframe canvas


    【解决方案1】:

    请参阅以下代码,了解适用于所有浏览器的 LIKE 按钮的示例实现。

    HTML:

    <iframe  id="IframeTemp" src="#"  scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:55px;" allowTransparency="true">
    </iframe>
    

    JavaScript:

    <script type="text/javascript">
        var currenturl = document.URL + "&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;height=55";
    
        var url = "//www.facebook.com/plugins/like.php?href="+currenturl;
        document.getElementById("IframeTemp").src = url;
        var myIframe = parent.document.getElementById("IframeTemp");  
    
        // Setup the width and height 
        myIframe.src = url;  
    </script>
    

    不要忘记将 Javascript 保留在开发人员 Facebook 中可用的母版页上。

    【讨论】:

      【解决方案2】:

      在我正在进行的项目中,我遇到了与您相同的问题。我发现您可以“喜欢”实际视频文件的网址,在您的情况下为 http://www.facebook.com/v/345848348745

      然而,这个解决方案的问题是喜欢不会聚合到实际视频页面的 url 上。它们将是两个独立的“类似”实体

      恐怕目前这似乎是 fb 之类功能的限制

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-10-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-07-03
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多