2016-09-27 76 views
0

我正在使用共享功能Facebook。登錄功能工作正常。但是,當我嘗試使用示例代碼分享內容時,它顯示爲Facebook API分享中顯示錯誤「抱歉,出現了問題,我們正在努力盡快解決問題。」

對不起,出錯了。

我們正在努力盡快解決問題。

我使用的代碼是

$('#fb_test').on('click', function(e){ 
    e.preventDefault(); 
    FB.ui(
    { 
     method: 'feed', 
     name: 'This is the content of the "name" field.', 
     link: 'URL which you would like to share ', 
     picture: "URL of the image which is going to appear as thumbnail image in share dialogbox", 
     caption: 'Caption like which appear as title of the dialog box', 
     description: 'Small description of the post', 
     message: '' 
    } 
    ); 
}); 

回答

0

使用此代碼,而不是您這將正常工作。

首先參考標籤後,該FB腳本

<script> 
    window.fbAsyncInit = function() { 
     FB.init({ 
      appId  : 'app_id', 
      xfbml  : true, 
      version : 'v2.8' 
     }); 
     FB.AppEvents.logPageView(); 
    }; 

    (function(d, s, id){ 
     var js, fjs = d.getElementsByTagName(s)[0]; 
     if (d.getElementById(id)) {return;} 
     js = d.createElement(s); js.id = id; 
     js.src = "//connect.facebook.net/en_US/sdk.js"; 
     fjs.parentNode.insertBefore(js, fjs); 
    }(document, 'script', 'facebook-jssdk')); 
</script> 

然後調用您的<a>點擊這個方法:

function ShareOnFacebook(){ 
FB.ui(
{ 
method: 'feed', 
name: 'test Blog title', 
link: 'http://stackoverflow.com/', 
picture: 'https://pbs.twimg.com/profile_images/740344950097903616/mORHo2rZ.jpg', 
caption: 'I love stackoverflow', 
description: 'The stackoverflow forum will provide good solutions', 
message: '' 
}); 
} 

這會爲你工作:)

相關問題