ユーザーがFacebookにログインしているときに、Facebook推奨プラグインを表示したい。私は結果が不愉快に見えるので、ユーザーがFacebookにログインしていないときにプラグインを表示したくありません。これも可能ですか?これを自分のサイトにどうやって実装しますか?ユーザーがログインしているときにFacebookの推奨プラグインを表示
ありがとうございました! マカ
のFacebookのソーシャルプラグイン(推奨) https://developers.facebook.com/docs/reference/plugins/recommendations/
以下のページで実装のように私はすでにJavascriptのSDKを持っています。また、jQuery1.5.2がページにロードされています。ここで
<div id="fb-root"></div> <script>
window.fbAsyncInit = function() {
FB.init({
appId : 'APP ID',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
channelUrl : 'http://urltomysite.com/channel.html' // custom channel
}); };
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());</script>
は、ユーザーがFBにログインしているかどうかを確認するためにFB.getLoginSTatusを使用することができます
<fb:recommendations site="urltomysite.com" width="300" height="300" header="true" font="" border_color=""></fb:recommendations>
あなたは "結果が不愉快に見える" とはどういう意味ですか?私は自分のサイトでそれを使用しているので、上手く見えます。 – Balanivash