应用程序内的 Facebook 请求对话框
我试图在画布应用程序内弹出一个请求对话框(朋友列表),但我遇到了麻烦,并且在教程上找不到任何帮助。
这里是身份验证后的代码等。有关
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId : '[**myid**]',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
</script>
<button id="send-to-many">Send to Many</button>
<div id="fb-root"></div>
<script>
document.getElementById('send-to-many').onclick = function() {
FB.ui({
method: 'apprequests',
message: 'You should learn more about blabla].',
}, Log.info.bind('send-to-many callback'));
}
</script>
如何在 FB 画布上启动 JS 的任何想法或示例吗?
I'm trying to popup a request dialog (of the list of friends) inside the canvas app, but I'm having troubles and I'm not finding any help on tutorials.
Here the code after the authentication, etc.
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId : '[**myid**]',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
</script>
<button id="send-to-many">Send to Many</button>
<div id="fb-root"></div>
<script>
document.getElementById('send-to-many').onclick = function() {
FB.ui({
method: 'apprequests',
message: 'You should learn more about blabla].',
}, Log.info.bind('send-to-many callback'));
}
</script>
any ideas or any examples of how to initiate the JS on a FB canvas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题是 FB.ui() 函数中的第二个参数应该是回调函数。尝试删除它并用 null 或已定义的函数或内联函数替换它。如果您确实需要调用 Log.info.bind,请确保定义该函数并包含定义脚本。现在,请尝试以下操作:
Facebook 文档提供了您想要执行的操作的示例和代码。查看他们的请求文档。
The problem is that the second parameter in the FB.ui() function is supposed to be a callback function. Try removing it and either replace it with null or a function that is defined or with an inline function. If you do need to call Log.info.bind, make sure the function is defined and the defining script gets included. For now, try something like:
Facebook documentation has examples and code for what you are trying to do. Check their requests documentation.
如果您想使用
Log.info.bind
,请将其更改为console.log()
If you want to use the
Log.info.bind
, change it toconsole.log()