嗨,我是 facebook 开发的新手,想使用下面的代码发布提要,但消息和 user_message_prompt 都没有出现在文本框中。我是否需要在我的应用程序中设置某些内容以允许这样做。我得到的只是默认消息。
我尝试了以下两种方法,它们都没有显示消息,也没有显示 user_message_prompt 消息。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title></title>
</head>
<body>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({ appId: "174009502722096", status: true, cookie: true, xfbml: true });
function postToFeed() {
var publish = {
method: 'feed',
message: 'Martin Okello presents share',
caption: 'Visit MartinLayooinc',
description: (
'Martin Okello, aka the medallion presents his application'
),
link: 'http://www.martinlayooinc.co.uk',
picture: 'http://www.martinlayooinc.co.uk/topImages/bigMedallion.jpg',
user_message_prompt: 'Share MartinLayooinc Software with friends!'
};
FB.ui(publish,
function(response)
{
alert('MartinLayooInc has been posted!!')
});
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
</script>
<!--from here-->
<div id="fb-root">
<p>
<a onclick='postToFeed(); return false;'><img src="topImages/facebook_button.png" style="height:20px; width:80px;" />
</a>
</p>
<p id='msg'>
</p>
</div>
</body>
</html>
<script type="text/javascript">
window.fbAsyncInit = function () {
FB.init({ appId: '174009502722096', status: true, cookie: true, xfbml: true });
/* All the events registered */
FB.Event.subscribe('auth.login', function (response) {
// do something with response
login();
});
FB.Event.subscribe('auth.logout', function (response) {
// do something with response
logout();
});
FB.getLoginStatus(function (response) {
if (response.session) {
// logged in and connected user, someone you know
login();
}
});
};
(function () {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
} ());
</script>