2012-02-04 13 views
0

Facebookアプリを使用して自分のサイトにFacebookの送信ボタンを統合しようとしています。私はFacebookの中にアプリを作成し、Webサイトのリンクに自分のサイトのURLを提供している:私は私のWebページに次のコードを使用していウェブサイトの送信ボタンの統合エラーが発生しました

<div id="fb-root"></div> 
<script> 
    window.fbAsyncInit = function() { 
    FB.init({appId: '1xxxxxxxxxx', status: true, cookie: true, xfbml: true}); 
    }; 
    (function() { 
    var e = document.createElement('script'); 
    e.type = 'text/javascript'; 
    e.src = document.location.protocol + '//connect.facebook.net/en_GB/all.js'; 
    e.async = true; 
    document.getElementById('fb-root').appendChild(e); 
    }()); 
</script> 

<script> 
    function trace(message) { 
     var div = document.getElementById('trace'); 
     div.innerHTML = div.innerHTML + message + '<br/>'; 
    } 
</script> 

は、送信するためにログインするウィンドウを表示していません友達にメールしてください。

答えて

1

送信プラグインのマークアップがありません。またjs.src =行はようにする必要があり

<div class="fb-send" data-href="http://example.com"></div>

js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId={APPID}";

0

私はjavascriptSDKを追加し、その後のFacebookからボタンのコードを送ることは、このようになります。私の頭の中で:

<script>window.fbAsyncInit = function() { FB.init({ appId : '1xxxxxxxxxxxxx', // App ID channelUrl : 'http://example.com/', // Channel File status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML }); }; // 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 = "http://connect.facebook.net/en_US/all.js"; d.getElementsByTagName('head')[0].appendChild(js); }(document)); </script><script>(function(d, s, id) {
//ボディセクションに

<div id="fb-root"></div> <br/> <div class="fb-send" data-href="http://example.com/"></div> 
合計コードは次のように次の
関連する問題