Check that you have: (some from http://wiki.developers.facebook.com/index.php/Connect/Setting_Up_Your_Site#Referencing_Facebook_Connect_on_Your_Site)
- Created xd_receiver.htm, and that it is in the root of your domain
- Included the FeatureLoader.js.php at the top of the BODY of your document
- Added the javascript in the question (e.g. FB_RequiresFeatures, etc) to the bottom of your document
An example of code that is currently running okay in my app:
<script type="text/javascript">
window.onload = function() {
FB_RequireFeatures(["XFBML", "Connect"], function() {
FB.Facebook.init("...my api key...","xd_receiver.htm");
FB.CanvasClient.syncUrl();
});
};
</script>
You can omit the "XFBML" from the FB_RequireFeatures call, and change the path to xd_receiver.htm too, and it should work okay.
In addition, double-check that the application's Connect URL (as set up via the Developer App in Facebook) points to a parent of the xd_receiver.htm file. So, if your app is hosted on http://www.mydomain.com, then looking at your code examples, your xd_receiver.htm will be at http://www.mydomain.com/xd_receiver.htm, and you'll want to have http://www.mydomain.com as the Connect URL.
If this still doesn't work, try installing Firebug (or similar tool) to have a look at the net traffic. When I was getting this to work, the Facebook Javascript API would fail silently, and it was only by inspecting the requests going back-and-forth that I spotted that Facebook didn't like my Connect URL.
In order to test that it's all working, I'd be tempted to use
FB.Connect.streamPublish();
rather that the line you posted, as it should pop-up a dialog, and is clearly given as a working example. I'm not sure what will happen if you just pass an empty string as an argument.
Finally, there are lots of IFrame-based Facebook apps out there - if you spot one that is doing something that you like, you can always have a look at their Javascript to find out how they achieved it. Or in other words, Facebook is full of example IFrame app code.