From Facebook Developer Wiki
[edit] Getting javascript error
Getting a javascript error:
"FB.XdComm.Server.singleton.get_hiddenIFrameContainer() has no properties"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Testing iFrame pop-up messages in JS Lib 0.4</title>
<script type="text/javascript" language="javascript" src="http://static.ak.facebook.com/js/api_lib/v0.4/FeatureLoader.js"></script>
</head>
<body>
<div>Welcome to the test. Please see the javascript debugger for the error message.</div>
<div id="debugMe"></div>
<!-- Note: include this div markup as a workaround for a known bug in
this release on IE where you may get a "operation aborted" error -->
<div id="FB_HiddenIFrameContainer" style="display:none; position:absolute; left:-100px; top:-100px; width:0px; height: 0px;"></div>
<!-- Text area to display tracing information to the Web page. If you use Firebug or Safari
debug console, these tracings will go to the JavaScript console as well. -->
<textarea style="width: 1000px; height: 300px;" id="_traceTextBox"></textarea>
<script type="text/javascript">
function debugMe(message)
{
document.getElementById("debugMe").innerHTML += "<br />" + message;
}
window.onload = function()
{
FB_RequireFeatures(["Integration"], function()
{
debugMe('Integration start');
FB.Facebook.init("cdbda6befb61cd707fdf31fb7b999c46", "/xd-receiver.html", null);
// will throw "FB.XdComm.Server.singleton.get_hiddenIFrameContainer() has no properties" error
debugMe('Integration end');
});
};
FB_RequireFeatures(["CanvasUtil"], function()
{
debugMe('CanvasUtil start');
FB.XdComm.Server.init("/xd-receiver.html");
FB.CanvasClient.setSizeToContent();
// will throw "FB.XdComm.Server.singleton.get_hiddenIFrameContainer() has no properties" error
debugMe('CanvasUtil end');
});
</script>
</body>
</html>
- 723026073 11:20, 29 July 2008 (PDT)
is this supposed to work yet? I tried but the 0.3 client but it doesn't seem to work / 502636034 - chainn.com
- You need to use the 0.4 client.
- I got this error: FB.XdComm.Server.singleton.get_hiddenIFrameContainer() is null even with 0.4 client in an iframe app:
<script type="text/javascript">
//<![CDATA[
var api_key = 'xxxxxxxxxxxxx';
var channel_path = 'include/facebook/xd_receiver.htm';
FB_RequireFeatures(["Api"], function(){
// Create an ApiClient object, passing app's API key and
// a site relative URL to xd_receiver.htm
FB.Facebook.init(api_key, channel_path);
var api = FB.Facebook.apiClient;
// require user to login
api.requireLogin(function(exception){
Debug.dump("Current user id is " + api.get_session().uid);
// Get friends list
api.friends_get(null, function(result){
Debug.dump(result, 'friendsResult from non-batch execution ');
});
});
});
//]]>
</script>
[edit] I couldn't get this to work.
Could we please get a complete example to include in the iframe? Thanks!