2
正在處理具有網站和Facebook頁面的項目。他們都引用了SWF文件用於與網站/ Facebook進行交互的相同的SWF文件和JS代碼。Facebook FB.ui stream.publish錯誤
調用FB.ui()方法進行共享的自定義Javascript操作非常有效,因爲出現對話框/彈出窗口,但Facebook導致出現錯誤(「發生錯誤,請稍後再試。」 )。我在所有瀏覽器中都遇到這個錯誤。
使用stream.share方法可以正常工作,但是stream.publish讓我在網站上感到悲傷。值得注意的是,Facebook中的代碼完全相同。
我通過兩個站點上的相同方法(Facebook頁面是託管在同一服務器上的iframe)加載FBJS SDK,並以相同的順序加載頁面的腳本。
function connectFacebook(score) {
// No score, share link
if (score == 0) {
FB.ui({
method: 'stream.share',
u: 'http://www.example.com/'
});
// Has score, publish to wall
} else {
FB.ui({
method: 'stream.publish',
message: 'I scored '+score+' at Game!',
attachment: {
name: 'Game',
caption: 'Game caption',
description: 'I scored '+score+'! Play and share to win the prize pack!',
href: 'http://www.example.com/'
},
action_links: [
{ text: 'Game', href: 'http://www.example.com/' }
],
user_message_prompt: 'Tell your friends about Game'
},
function(response) {
if (response && response.post_id) {
//alert('Post was published.');
} else {
//alert('Post wasn\'t published.');
}
});
}
}