2012-01-12 36 views

回答

1

由於在您的問題中很少有繼續。沒有例子url,沒有代碼示例。我只能猜測。所以這裏是從哪裏開始。

1)請務必在腳本標籤內包含Javascript SDK。

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

2)一定要包括主體

<body> 
    <div id="fb-root"></div> 
    ...your html here... 
</body> 

3)一定要執行FB.init()和FB.Canvas.setSize內的FB-根的div()之後JavaScript SDK有機會加載。這意味着做你window.fbAsyncInit內

window.fbAsyncInit = function() { 
    FB.init({ 
     appId  : 'YOUR_APP_ID', // App ID 
     channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File 
     status  : true, // check login status 
     cookie  : true, // enable cookies to allow the server to access the session 
     xfbml  : true // parse XFBML 
    }); 
    }; 

4)確保您已指定應用ID,也是正確的位置,有效ChannelUrl