4

我正在嘗試讓Facebook提要對話框在測試網站上工作,但我不斷收到相同的錯誤消息:「[app_name]發生錯誤,請稍後重試。」 當我看到documentation時,我意識到文檔中的示例也不起作用。Facebook提要對話框無法正常工作

已經嘗試了許多不同的解決方案。 這裏是我的測試代碼:

<html xmlns:fb="https://www.facebook.com/2008/fbml"> 
    <body> 
    <div id="fb-root"></div> 
<script> 
    window.fbAsyncInit = function() { 
    // init the FB JS SDK 
    FB.init({ 
     appId  : '400714233333865', // App ID from the App Dashboard 
     channelUrl : '//demo.xxxxxxx.se/nptest/channel.html', // Channel File for x-domain communication 
     status  : true, // check the login status upon init? 
     cookie  : true, // set sessions cookies to allow your server to access the session? 
     xfbml  : true // parse XFBML tags on this page? 
    }); 

    // Additional initialization code such as adding Event Listeners goes here 

    }; 

    function postToFeed(){ 

    FB.ui(
    { 
    method: 'feed', 
    name: 'The Facebook SDK for Javascript', 
    caption: 'Bringing Facebook to the desktop and mobile web', 
    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.' 
    ), 
    link: 'https://developers.facebook.com/docs/reference/javascript/', 
    picture: 'http://www.fbrell.com/public/f8.jpg' 
    }, 
    function(response) { 
    if (response && response.post_id) { 
     alert('Post was published.'); 
    } else { 
     alert('Post was not published.'); 
    } 
    } 
); 

}; 

    // Load the SDK's source Asynchronously 
    (function(d){ 
    var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; 
    if (d.getElementById(id)) {return;} 
    js = d.createElement('script'); js.id = id; js.async = true; 
    js.src = "//connect.facebook.net/en_US/all.js"; 
    ref.parentNode.insertBefore(js, ref); 
    }(document)); 
</script> 



    <div id='fb-root'></div> 
<a onClick="postToFeed('Text');"> 
    Share in the feeeeeeeeeeeeed 
</a> 
    </body> 
</html> 

有沒有人碰到類似的問題或一個解決方案?

回答

3

確保您正在通過應用程序設置中指定的相同URL進行測試。在您的提要對話框中,提供您自己的鏈接和圖像,即應用程序設置中指定的您自己的域的鏈接,而不是Facebook中的示例。

+0

就是這樣!不能相信我一整天都錯過了。謝啦! – PaperThick

相關問題