views:

313

answers:

1

I would like to publish streams on an external Facebook Connect website.

This should be done via the JavaScript client library which I've already included.

The code of my page is as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="de" lang="de">
<head>
[...]
</head>
<body>
[...]
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/de_DE" type="text/javascript"></script>
<script type="text/javascript">
FB.init("XYZ", "xd_receiver.htm");
FB.Connect.ifUserConnected(set_cookies_and_refresh());
</script>
[...]
<script type="text/javascript">
var addedLinks = [{ "text": "Challenge XYZ now", "href": "http://example.org/page1.html" }];
FB.Connect.streamPublish("", null, addedLinks, null, "What do you want to add?");
</script>
[...]
</body>
</html>

The stream dialogue should be opened as soon as the page is loaded.

What's wrong? Can you help me? Thank you very much!

+2  A: 

You'll need to ensure that the Connect library has loaded before attempting to use it.

FB.ensureInit(function() {
  // do something here
});
ceejayoz
Thank you :) It seems that I'm to stupid to read ;(