为什么不't我的Facebook应用程序发送邀请请求
Why doesn't my Facebook app send Invite requests?
我已经做了几天了,找不到缺少的东西。有人有什么建议吗?
它似乎缺少了什么,但我不知道它会是什么。
我没有收到任何错误。共享按钮可以工作(共享到你自己的墙上),但邀请似乎根本没有任何作用。
我把我的appid换成了X。
<html>
<head>
<title>App Name</title>
</head>
<body>
<div id="fb-root"></div>
<script>
var publish = {
method: 'stream.publish',
display: 'popup', // force popup mode
attachment: {
name: 'Connect',
caption: 'The Facebook Connect JavaScript SDK',
description: (
'A small JavaScript library that allows you to harness ' +
'the power of Facebook, bringing the user''s identity, ' +
'social graph and distribution power to your site.'
),
href: 'http://app-address.com/'
}
};
function publish1() {
FB.ui(publish);//, Log.info.bind('stream.publish callback'));
}
</script>
<button class="btn" id="send-to-many">Send to Many</button>
<button onclick="publish1()">Click</button>
</body>
<script>
window.fbAsyncInit = function() {
console.log('Initing facebook...');
FB.init({
appId: 'xxxxxxxxxxxxxxx',
status: true,
frictionlessRequests: true,
cookie: true,
xfbml: true
});
console.log('... done');
};
(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);
}());
document.getElementById('send-to-many').onclick = function() {
FB.ui({
method: 'apprequests',
message: 'This is a test of the App-Name invite.'
}, requestCallback);
function requestCallback(response)
{
if(response && response.request_ids) {
// Here, requests have been sent, facebook gives you the ids of all requests
//console.log(response);
location.href='home';
} else {
// No requests sent, you can do what you want (like...nothing, and stay on the page).
}
}
}
</script>
</html>
您的代码看起来不错。你的facebook应用程序设置中一定有错误。对于邀请功能,您必须提供"画布URL"&安全画布URL"在您的facebook应用程序设置中。你也可以试试下面的代码。这是一个实现起来非常简单的代码。
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId:'APP_ID',
cookie:true,
status:true,
xfbml:true
});
function FacebookInviteFriends()
{
FB.ui({
method: 'apprequests',
message: 'Your Message diaolog'
});
}
</script>
//HTML Code
<div id="fb-root"></div>
<a href='#' onclick="FacebookInviteFriends();">
Facebook Invite Friends Link
</a>
在这里,您必须再编写一个javascript代码来破坏iframe。这样链接就不会在脸书内部打开。你还必须在你的主页或网站的任何其他页面上写下同样的js代码,你希望你的应用程序重定向。
<script type='text/javascript'>
if (top.location!= self.location)
{
top.location = self.location
}
</script>
如有任何疑问,请随时在这里写信。
我遇到了类似的问题,发现您必须单击DONE
按钮。这是一个表单,DONE
按钮提交表单。
相关文章:
- MockJax没有在JavaScript应用程序中发送对我AJAX请求的响应
- 在openshift node js应用程序中获取请求
- 从C#应用程序向Angular页面发送帖子请求
- 只需添加一个'允许跨来源请求'到我的节点应用程序工作
- 如何让应用程序帮助程序方法在发送的请求为 JS 格式时工作
- 在安装后首次运行应用程序时从 UIBebView 发出 jQuery Ajax 请求
- 读取Angular应用程序中请求的url
- 为什么不't我的Facebook应用程序发送邀请请求
- 当我们打开ADF应用程序的同一网页的不同版本时,如何让浏览器请求java脚本
- 在angular cordova应用程序中发布一个请求中的多个文件
- Chrome应用程序中AJAX请求的限制是什么
- 在express应用程序中,请求参数两次附加到URL
- 如何在同构应用程序中通过节点提取传递请求cookie
- Facebook应用程序未请求manage_pages许可
- 我正在用apachecordova开发一个应用程序,但每次我向局域网上的服务器发出ajax请求时,我都会收到这个错误
- 使用沙箱从Chrome应用程序发出ajax请求
- Facebook Graph API-#4错误-已达到应用程序请求限制
- Ajax get jsonp给出错误代码500“;请求被阻止”;来自MVC应用程序
- HTTP 请求后,数据未显示在 Ember 应用程序中
- 发送请求2.0应用程序生成的请求到非"/me"