2012-04-29 6 views
0

をメッセージもuser_prompt_messageを示すないFb.uiの給紙方法を使用してこんにちは、私はFacebookの開発に新しいです、そして以下のコードを使用してフィードを投稿したいと思いますが、メッセージもuser_message_promptがに表示されません。テキストボックス。これを可能にするために私のアプリケーションに何かを設定する必要がありますか?私が得るのは、デフォルトのメッセージだけです。すべて使用して、デフォルトのメッセージで

私は、以下の2つの方法を試みたが、それらの両方は、メッセージやuser_message_promptメッセージは表示されません。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> 
<head> 
    <title></title> 
</head> 
<body> 
<script src="http://connect.facebook.net/en_US/all.js"></script> 
<script> 

     FB.init({ appId: "174009502722096", status: true, cookie: true, xfbml: true }); 

     function postToFeed() { 

     var publish = { 
     method: 'feed', 
     message: 'Martin Okello presents share', 
     caption: 'Visit MartinLayooinc', 
     description: (
     'Martin Okello, aka the medallion presents his application' 
     ), 
     link: 'http://www.martinlayooinc.co.uk', 
     picture: 'http://www.martinlayooinc.co.uk/topImages/bigMedallion.jpg', 
     user_message_prompt: 'Share MartinLayooinc Software with friends!' 
     }; 

     FB.ui(publish, 
     function(response) 
     { 
     alert('MartinLayooInc has been posted!!') 
     }); 

     function callback(response) { 
     document.getElementById('msg').innerHTML = "Post ID: " + response['post_id']; 
     } 

     FB.ui(obj, callback); 

     } 

</script> 
    <!--from here--> 
    <div id="fb-root"> 
     <p> 
      <a onclick='postToFeed(); return false;'><img src="topImages/facebook_button.png" style="height:20px; width:80px;" /> 
      </a> 
     </p> 
     <p id='msg'> 
     </p> 
    </div> 
</body> 
</html> 
<script type="text/javascript"> 
    window.fbAsyncInit = function() { 
     FB.init({ appId: '174009502722096', status: true, cookie: true, xfbml: true }); 

     /* All the events registered */ 
     FB.Event.subscribe('auth.login', function (response) { 
      // do something with response 
      login(); 
     }); 
     FB.Event.subscribe('auth.logout', function (response) { 
      // do something with response 
      logout(); 
     }); 

     FB.getLoginStatus(function (response) { 
      if (response.session) { 
       // logged in and connected user, someone you know 
       login(); 
      } 
     }); 
    }; 
    (function() { 
     var e = document.createElement('script'); 
     e.type = 'text/javascript'; 
     e.src = document.location.protocol + 
      '//connect.facebook.net/en_US/all.js'; 
     e.async = true; 
     document.getElementById('fb-root').appendChild(e); 
    }()); 
</script> 

答えて

4

私はどちらも推奨されていません。メッセージパラメータは無視され、ドキュメントの他のパラメータは表示されませんでした。どうやら、Facebookは、ユーザーがテキストフィールドに自分のメッセージを入れることなく、強制的またはプロンプトが表示されたいです。

https://developers.facebook.com/docs/reference/javascript/FB.ui/

を、ここで詳細ページ::ここにそれのための主要な情報ページをチェックしてください下に

https://developers.facebook.com/docs/reference/dialogs/feed/

スクロールして、あなたはサポートされているパラメータが表示されます。うまくいけば、それはあなたのためのゲームチェンジャーではない。

-1

あなたは次に以下のような関数を呼び出して、この

window.fbAsyncInit = function() {FB.init({ 
appId: '{YOUR APP ID}', 
xfbml: true, 
version: 'v2.1' 
}); 
}; 
(function(d, s, id) { 
var js, fjs = d.getElementsByTagName(s)[0]; 
if (d.getElementById(id)) { 
return; 
} 
js = d.createElement(s); 
js.id = id; 
js.src = "//connect.facebook.net/en_US/sdk.js"; 
fjs.parentNode.insertBefore(js, fjs); 
}(document, 'script', 'facebook-jssdk')); 

function share_prompt() { 
FB.ui({ 
method: 'feed', 
name: 'Your App Name', 
link: 'https://example.com', 
picture: 'http://example.com/img/fbicon.jpg', 
caption: 'Your Caption here', 
description: 'some sort of your own description', 
message: 'Your Message goes here mate' 
}); 
} 

ような何かを行う必要があります。

<div><a href="#" onclick="share_prompt()">Click to open your dialog</a>  </div> 
関連する問題