简体   繁体   English

活动供稿插件未呈现

[英]Activity feed plugin not rendering

I wanted to just get a basic understanding of how the Activity Feed plug-in works so I figured I would set up a small example on an html page just to see what it looks like.I am using the FBML method of creating the control. 我只是想对Activity Feed插件的工作原理有一个基本的了解,所以我想我会在html页面上设置一个小示例,以查看它的外观。我正在使用FBML方法创建控件。 The problem is the feed is not rendering. 问题是提要没有呈现。 As I said I just wanted to test how things work so I am using http://www.facebook.com as the domain. 就像我说的那样,我只是想测试一下工作原理,因此我将http://www.facebook.com用作域。 Again this is simple as can be but I'm not seeing the control render. 再次,这很简单,但是我看不到控件的渲染。 Here is my code in it's entierty: 这是我的完整代码:

<!DOCTYPE html>
<html>
  <head>
    <title>Facebook API Testing</title>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
  </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/all.js#xfbml=1&appId=myid";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

    <h1>Facebook API Testing</h1>
    <div>
    <fb:activity href="http://www.facebook.com" action="like" width="300" height="300" header="true" recommendations="true"></fb:activity>
    </div>
  </body>
</html>

I am not getting an error of any kind. 我没有任何错误。 I'm just not seeing anything. 我什么都没看见。 When I inspect the page I see that the fb activity feed markup is there: 当我检查页面时,我发现那里有fb活动供稿标记:

<fb:activity href="http://www.facebook.com" action="like" width="300" height="300" header="true" recommendations="true"></fb:activity>

Solved 解决了

Ok this has been solved apparently this doesn't work if you try to run it from a stand alone html file on your local machine. 好的,这已经解决了,如果您尝试从本地计算机上的独立html文件运行它,则显然无法正常工作。 When I uploaded the above to a webserver and viewed the page things were rendering. 当我将以上内容上传到网络服务器并查看页面时,事情正在呈现。

Ok this has been solved apparently this doesn't work if you try to run it from a stand alone html file on your local machine. 好的,这已经解决了,如果您尝试从本地计算机上的独立html文件运行它,则显然无法正常工作。 When I uploaded the above to a webserver and viewed the page things were rendering. 当我将以上内容上传到网络服务器并查看页面时,事情正在呈现。

That's because the address of the JS SDK is given as //connect.facebook.net – to allow the browser to chose whether to use HTTP or HTTPS in requesting the script automatically. 这是因为JS SDK的地址为//connect.facebook.net允许浏览器选择在自动请求脚本时使用HTTP还是HTTPS。 Of course, this can only work if the page itself is access by either of those two protocols – not when it's accessed via file://. 当然,这仅在页面本身可以通过这两种协议之一访问时才有效,而在通过file://访问时则无效。

You could use a local web server to test things like this – or you can put the http: in front of the script address yourself. 您可以使用本地Web服务器来测试类似的内容,也可以将http:放在脚本地址前面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM