views:

1417

answers:

2

This program should prompt the user to update their stream; instead it does nothing but print "splendid!" on the console. What am I missing here? The documentation seems to suggest that this is all it takes. (I've hidden my API key with Xs; normally I'd use a real key.)

<html><head></head>
<body>
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
<script>

FB_RequireFeatures(["Connect"], function(){ 
  FB.init("XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "xd_receiver.htm");
  FB.ensureInit(function() {
    alert(FB.Connect.streamPublish("", null, null, null, null, function(){
      console.info("called back");
    }));
    console.info("wonderful!");
  });
});
</script>
</body>
</html>
A: 

It turns out that this code is perfect, but it only works on the website given by the Facebook app's configured "Connect URL." There is no error message displayed on the console when this happens.

Dan Fabulich
A: 

I was able to solve this problem for myself only because of information in this post. Dan, thank you for providing the answer.

To clarify: In order for FB.Connect.streamPublish to work in iframe Facebook app you need to configure your Connect URL to be the same as your Canvas URL (by clicking Edit Settings in Facebook Developer application). Of course, you need to deploy xd_receiver.htm to your server as well.

Serge Khorun