我怎样才能看到Facebook API的输出

时间:2014-06-20 11:07:37

标签: javascript facebook social facebook-social-plugins

您好我发现了Facebook API的实例,但是当我分享时,它显示以下错误:

Sorry, this feature isn't available right now

http://jsbin.com/egatas/latest

请帮我解决这个问题。

注意:当我在我的网站上应用该代码时,它在共享时显示以下错误:

API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: redirect_uri is not owned by the application.

 <div id="fb-root"></div>
  <script>
    window.fbAsyncInit = function() {
      // init the FB JS SDK
      FB.init({
        appId      : '313138655528355',  // App ID from the app dashboard
        // Channel file for x-domain comms
        status     : true,               // Check Facebook Login status
        xfbml      : true                // Look for social plugins on the page
      });

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

    // Load the SDK asynchronously
    (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/all.js";
       fjs.parentNode.insertBefore(js, fjs);
     }(document, 'script', 'facebook-jssdk'));
  </script>

  <div class="well">
    <button class="btn btn-info share-btn">Share</button>
  </div>

<script>
function fb_share() {
    FB.ui( {
        method: 'feed',
        name: "Facebook API: Tracking Shares using the JavaScript SDK",
        link: "https://www.webniraj.com/2013/05/11/facebook-api-tracking-shares-using-the-javascript-sdk/",
        picture: "https://stackexchange.com/users/flair/557969.png",
        caption: "Tracking Facebook Shares on your website or application is a useful way of seeing how popular your articles are with your readers. In order to tracking Shares, you must used the Facebook JavaScript SDK."
    }, function( response ) {
        if ( response !== null && typeof response.post_id !== 'undefined' ) {
            console.log( response );
            // ajax call to save response
          $.post( 'http://www.webniraj.com/', { 'response': response }, function( result ) {
                console.log( result );
            }, 'json' );
        }
    } );

}

$(document).ready(function(){
  $('button.share-btn').on( 'click', fb_share );
});
</script>

0 个答案:

没有答案
相关问题