Facebook多好友选择器不';t渲染(iFrame应用程序)
我有一个iframe Facebook应用程序(使用Facebook的新JavaScript API),它需要允许用户在参加比赛后邀请他们的朋友使用该应用程序。我在页面的div中有以下标记(应用程序名称和画布Url已编辑):Facebook多好友选择器不';t渲染(iFrame应用程序),facebook,xfbml,Facebook,Xfbml,我有一个iframe Facebook应用程序(使用Facebook的新JavaScript API),它需要允许用户在参加比赛后邀请他们的朋友使用该应用程序。我在页面的div中有以下标记(应用程序名称和画布Url已编辑): 据我所知,如果您需要在XFBML/iframe应用程序中使用FBML标记,只需将它们放入fb:serverFbml元素中,Facebook就会处理它。果然,我的第一印象似乎是错误的。我得到的不是表格,而是一个空白的白色框,fbml似乎没有动过 这个应用程序的设计假设(可
据我所知,如果您需要在XFBML/iframe应用程序中使用FBML标记,只需将它们放入fb:serverFbml元素中,Facebook就会处理它。果然,我的第一印象似乎是错误的。我得到的不是表格,而是一个空白的白色框,fbml似乎没有动过
这个应用程序的设计假设(可能是错误的)我不需要验证用户的身份,让他们邀请他们的朋友。有没有办法做到这一点,或者我需要要求他们先登录?Facebook的文档(当然)对此含糊不清
根据请求编辑:My FB.init():
$("body").prepend("<div id=\"fb-root\"></div>");
FB.init({
apiKey: "{My apiKey is here}",
appId: "{My appId is here}",
status: true,
cookie: true,
xfbml: true
});
$(“正文”)。前缀(“”);
FB.init({
apiKey:{我的apiKey在这里},
appId:“{我的appId在这里}”,
状态:正确,
曲奇:是的,
xfbml:对
});
好的,我让它开始工作了。以下是我的感受:
<fb:serverfbml>
<script type="text/fbml">
<fb:fbml>
<fb:request-form action='my_url' method='POST'
invite='true'
type='Poll'
content='This is an invitation! <fb:req-choice url="my_url" label="Accept and join" /> '>
<fb:multi-friend-selector showborder='false' actiontext='Select friends to send the poll' cols='5' rows='3' bypass='cancel' max="8">
</fb:request-form>
</fb:fbml>
</script>
</fb:serverfbml>
JS注入代码如下所示:
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: 'YOUR APP ID HERE',
status: true,
cookie: true,
xfbml: true
});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
window.fbAsyninit=函数(){
FB.init({
appId:'您的应用程序ID在此',
状态:正确,
曲奇:是的,
xfbml:对
});
};
(功能(){
var e=document.createElement('script');e.async=true;
e、 src=document.location.protocol+
“//connect.facebook.net/en_US/all.js”;
document.getElementById('fb-root').appendChild(e);
}());
所以
1) 您不需要应用程序密钥,只需要JS代码中的应用程序ID
2) XFBML需要包装在一个脚本标记中。好的,我让它开始工作了。以下是我的感受:
<fb:serverfbml>
<script type="text/fbml">
<fb:fbml>
<fb:request-form action='my_url' method='POST'
invite='true'
type='Poll'
content='This is an invitation! <fb:req-choice url="my_url" label="Accept and join" /> '>
<fb:multi-friend-selector showborder='false' actiontext='Select friends to send the poll' cols='5' rows='3' bypass='cancel' max="8">
</fb:request-form>
</fb:fbml>
</script>
</fb:serverfbml>
JS注入代码如下所示:
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: 'YOUR APP ID HERE',
status: true,
cookie: true,
xfbml: true
});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
window.fbAsyninit=函数(){
FB.init({
appId:'您的应用程序ID在此',
状态:正确,
曲奇:是的,
xfbml:对
});
};
(功能(){
var e=document.createElement('script');e.async=true;
e、 src=document.location.protocol+
“//connect.facebook.net/en_US/all.js”;
document.getElementById('fb-root').appendChild(e);
}());
所以
1) 您不需要应用程序密钥,只需要JS代码中的应用程序ID
2) XFBML需要包装在脚本标记中。此示例也适用:
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=APP_ID&xfbml=1"></script><fb:serverfbml>
<script type="text/fbml">
<fb:fbml>
<fb:request-form action='my_url' method='POST'
invite='true'
type='Poll'
content='This is an invitation! <fb:req-choice url="my_url" label="Accept and join" /> '>
<fb:multi-friend-selector showborder='false' actiontext='Select friends to send the poll' cols='5' rows='3' bypass='cancel' max="8">
</fb:request-form>
</fb:fbml>
</script>
</fb:serverfbml>
在中设置应用程序IDhttp://connect.facebook.net/en_US/all.js#appId=[APP_ID]&xfbml=1此示例也适用:
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=APP_ID&xfbml=1"></script><fb:serverfbml>
<script type="text/fbml">
<fb:fbml>
<fb:request-form action='my_url' method='POST'
invite='true'
type='Poll'
content='This is an invitation! <fb:req-choice url="my_url" label="Accept and join" /> '>
<fb:multi-friend-selector showborder='false' actiontext='Select friends to send the poll' cols='5' rows='3' bypass='cancel' max="8">
</fb:request-form>
</fb:fbml>
</script>
</fb:serverfbml>
在中设置应用程序IDhttp://connect.facebook.net/en_US/all.js#appId=[APP_ID]&xfbml=1您还可以显示您的js api init方法吗?为您的问题添加了my FB.init()。邀请表单是在初始加载后动态添加到页面还是从一开始就存在?等等。我只是让它工作;我必须在serverFbml中集成一个脚本标记,我想我的引用放错了地方。这东西太脆了。我将很快发布固定标记。您能否发布代码/步骤,说明如何使其工作?我也面临着类似的问题。你能展示一下你的js api init方法吗?为你在问题中添加了我的FB.init()。邀请表单是在初始加载后动态添加到页面还是从一开始就存在?等等。我只是让它工作;我必须在serverFbml中集成一个脚本标记,我想我的引用放错了地方。这东西太脆了。我将很快发布固定标记。您能否发布代码/步骤,说明如何使其工作?我面临着类似的问题。