我正在通过以下代码共享/发布。希望能帮助到你。fbImg && fbTxt 是通过 jquery 从我的站点中提取的动态图像
function publishWallPost() {
var fbImg = $('.head .headerLeft p img')[0].src;
var fbTxt = $('.head .headRight span.artistName').text();
FB.ui({
method: 'feed',
name: 'Pandora - Which Star Are You',
caption: 'https://www.facebook.com/pages/Pandora/119285608270259?id=119285608270259&sk=app_535647489852225',
description: 'According to Pandora\'s Which Star Are You competition, I\'m ' + fbTxt + '. Click on the artist\'s picture to find out which star you are!',
link: 'https://www.facebook.com/pages/Pandora/119285608270259?id=119285608270259&sk=app_535647489852225',
picture: fbImg
},
function (response) {
console.log('publishStory response: ', response);
});
return false;
}
window.fbAsyncInit = function () {
FB.init({
appId: '535647489852225',
status: true,
cookie: true,
xfbml: true
});
};
(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);
}());