简体   繁体   中英

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. 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. 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: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. 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. 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. 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://.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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