我已经为此工作了几天,但找不到丢失的内容。有人有建议吗?
它似乎缺少一些东西,但我不知道它会是什么。
我没有收到任何错误。分享按钮有效(分享到您自己的墙上),但邀请似乎根本没有做任何事情。
我已经用 X 替换了我的 appid。
<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>