如何在我的 iframe facebook 应用程序中解析此 xFBML 邀请表单?
我有一个 Facebook 画布应用程序,它已经可以在服务器端和客户端进行身份验证。我可以在我的用户墙上发布,并在画布中运行我的应用程序。
我想添加一个“邀请你的朋友”页面,并按照文档创建一个 xFBML 表单:
[...]
<div id='invite-friends-form'>
<fb:serverfbml style="width: 650px;">
<script type="text/fbml">
<fb:fbml>
<fb:request-form
action="http://www.myapp.com:8080//invite/"
method="POST"
invite="true"
type="Name of my app"
content="My app description
<fb:req-choice url='http://apps.facebook.com/myapp/'
label='Accept'
/>
" >
<fb:multi-friend-selector
showborder="false"
actiontext="Invite your friends to my app"
rows="4"
> <fb:multi-friend-selector />
</fb:request-form>
</fb:fbml>
</script>
</fb:serverfbml>
</div>
<div id='fb-root'></div>
</body>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="http://connect.facebook.net/fr_FR/all.js"></script>
<!-- This does nothing so I commented it out. Can't find a way to debug
<script src="http://static.ak.fbcdn.net/connect/en_US/core.debug.js"></script> -->
<script src="http://myapp.com:8080/js/my_app_js.js"></script>
</html>
在他们的 测试页面。
现在,在我的 iframe 中,除了永远显示的 facebook 加载动画之外什么也没有。
这是我的 JavaScript。一旦 DOM 准备好,我就使用 jQuery 运行代码:
$(function(){
FB.init({
appId : 'my_app_id',
status : true,
cookie : true,
xfbml : true,
level : "debug"
});
FB.getLoginStatus(function(response) {
if (response.session) {
// logged in and connected user, someone you know
alert('logged in'); // this always show up
FB.XFBML.parse(document.getElementById('invite-friends-form'),
function(e) {alert(e)}
);
alert('after xfmbl parsing'); // this sometime show up
}
});
[...]
我没有显示任何错误,并且无论如何也找不到调试它的方法。我感觉被困住了。
热烈欢迎帮助:-)
I got a Facebook canvas apps that already works for authentification on server side and client side. I can post on the wall of my user, and run my app in the canvas fine.
I wanted to add a 'invite your friends' page, and followed the doc by creating a xFBML form:
[...]
<div id='invite-friends-form'>
<fb:serverfbml style="width: 650px;">
<script type="text/fbml">
<fb:fbml>
<fb:request-form
action="http://www.myapp.com:8080//invite/"
method="POST"
invite="true"
type="Name of my app"
content="My app description
<fb:req-choice url='http://apps.facebook.com/myapp/'
label='Accept'
/>
" >
<fb:multi-friend-selector
showborder="false"
actiontext="Invite your friends to my app"
rows="4"
> <fb:multi-friend-selector />
</fb:request-form>
</fb:fbml>
</script>
</fb:serverfbml>
</div>
<div id='fb-root'></div>
</body>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="http://connect.facebook.net/fr_FR/all.js"></script>
<!-- This does nothing so I commented it out. Can't find a way to debug
<script src="http://static.ak.fbcdn.net/connect/en_US/core.debug.js"></script> -->
<script src="http://myapp.com:8080/js/my_app_js.js"></script>
</html>
This xFBML renders fine when tested in their test page.
Now, in my iframe, I got nothing but the facebook loading animation displaying forever.
Here is my Javascript. I use jQuery to run the code once DOM is ready:
$(function(){
FB.init({
appId : 'my_app_id',
status : true,
cookie : true,
xfbml : true,
level : "debug"
});
FB.getLoginStatus(function(response) {
if (response.session) {
// logged in and connected user, someone you know
alert('logged in'); // this always show up
FB.XFBML.parse(document.getElementById('invite-friends-form'),
function(e) {alert(e)}
);
alert('after xfmbl parsing'); // this sometime show up
}
});
[...]
I got no error showing up, and can't find anyway to debug this. I feel stuck.
Help warmly welcome :-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到了:
您需要在应用程序设置的互联网站点部分填写“url”和“域名”,其中 url 是完整的网址(而不是画布网址),域应该类似于“mysite.com”。
Found it:
You need to fill "url" and "domain name" in the internet site section of your app settings with url being the full web url (not the canvas one) and domain should be something like "mysite.com".