1

最初に: 私は英語が苦手で、英語があまり上手ではありません。FB アプリに問題があります。

これはコードです:

//My Script
<script src="http://connect.facebook.net/en_US/all.js"></script>
<p><a onload="postToFeed(); return false;"> </a></p>

<p id="msg"></p>

<script>
  FB.init({appId: "********", status: true, cookie: true});

  function postToFeed() {

    // calling the API ...
    var obj = {
      method: "feed",
      link: "http://apps.facebook.com/bachflower/",
      picture: "http://glacial-hollows-5787.herokuapp.com/images/37p.png",
      name: "Wild Rose - Rosa Canina",
      caption: " ",
      description: "Dona: Decisione, motivazione, accettazione con gioia del quotidiano. Chi ne ha bisogno tende a pensare: Non vale la pena… meglio rinunciare. Non serve a nulla… - App by medicinanaturale.pro"
    };

    function callback(response) {

    }

    FB.ui(obj, callback);
  }

</script>

//This is my body OnLoad
<body text="#000000" onLoad="postToFeed();" >

問題は、postToFeed の通知を自分のウォールで正しく表示して共有できる人がいるということです。また、postToFeed について何も表示されない人もいます。なんで?

誰でも私を助けることができますか?

ありがとう、アンドレア

4

1 に答える 1

0

postToFeed() 関数は、FB がロードされて初期化される前に呼び出される場合があります。次のように、非同期読み込みを使用します。

<div id="fb-root"></div>
<script>
    window.fbAsyncInit = function() {
    // init the FB JS SDK
        FB.init({
           appId      : 'YOUR_APP_ID', // App ID from the App Dashboard
           channelUrl : '//WWW.YOUR_DOMAIN.COM/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?
        });

        postToFeed();

    };

  // Load the SDK's source Asynchronously
    (function(d, debug){
       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" + (debug ? "/debug" : "") + ".js";
       ref.parentNode.insertBefore(js, ref);
    }(document, /*debug*/ false));
</script>

ここを参照してください: http://developers.facebook.com/docs/reference/javascript/

于 2012-11-12T11:33:32.003 に答える