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 回答