2012-05-18 9 views
7

私はこれに何時間も費やしてしまったので挫折しています。他のスレッドもここにありますが、誰も私の問題を解決していません!fbのようなボタンが表示されないのはなぜですか?

私は単に私のウェブサイトのwww.posti.shにfbのようなボタンを実装したいのですが、なぜうまくいかないのでしょうか?ここ

ステップチュートリアルによってhttps://developers.facebook.com/docs/reference/plugins/like/ステップによれば、私が使用するコードである:私はそれがしたい

<div id="fb-root"></div> (directly after the opening body tag) 

<div class="fb-like" data-href="http://www.posti.sh" data-send="true" data-width="450" data-show-faces="true"></div> 

私はまた、頭に対応するメタタグを追加しました。

それはなぜ動作しないのですか?

ありがとうございました!

デニス

UPDATE 1

私はFBのデバッグツールhttps://developers.facebook.com/tools/debugを使用して、それが唯一のOGの画像の大きさが十分ではないと言う - 私はそれはしかし、問題をすべきではないと思いますか?

答えて

4

HTML5 Like Buttonコードのステップ1のように、実際にJavascript SDKが追加されている部分がありません。コードは次のようにする必要があります:

<div id="fb-root"></div> 
<script> 
    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 
    }); 

    // Additional initialization code here 
    }; 

    // Load the SDK Asynchronously 
    (function(d){ 
    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.js"; 
    ref.parentNode.insertBefore(js, ref); 
    }(document)); 
</script> 
+0

素晴らしい、ありがとうございます!それは動作しますが、私はアプリのIDとファイルchannel.htmlを提供する必要がありますか?私はどちらも持っていません... – weltschmerz

+0

いいえ、[FB.init docs](https://developers.facebook.com/docs/reference/javascript/FB.init/)によると、すべての引数はオプションです。 – freejosh

+0

ありがとうございます! – weltschmerz

0

ちょうど私は同様の問題を解決しました。 FBのようなボタンが表示されましたが機能しませんでした。

私のページで<div id="fb-root"></div>divにあり、position: relative;css属性であった。 position: relative;を削除した後、再び動作します。

関連する問題