我想使用图形对象在Facebook上分享我们的应用程序

时间:2013-09-10 06:44:02

标签: php javascript facebook facebook-graph-api

当我点击分享按钮然后它是cout作为我有分享实际上我不会分享我们的应用程序。我们如何实际在墙上获得我们的应用程序份额,然后给予返回值份额。请给我解决方案

我的代码

enter <script type="text/javascript">
var title = 'LG Pocket Photo Printer';
 var summary = 'Pocket Photo App has various functions to edit your photo. Choose a photo and decorate as you like using various & special effects in Pocket Photo App';
var url = 'http://lgcelebrations.com/lgpocketphoto';
var image = 'http://featherfiles.aviary.com/2013-07-05/m5tanou3rq46rvrd/df05c59155124ef09c1a94c5be7e25ed.jpg';
var fb = window.open('http://www.facebook.com/sharer.php?s=100&p[title]='+encodeURIComponent(title)+'&p[url]='+encodeURIComponent(url)+'&p[summary]='+encodeURIComponent(summary)+'&p[images][0]='+encodeURIComponent(image));
fb.focus();

1 个答案:

答案 0 :(得分:1)

<p><a onclick='postToFeed(); return false;'><img src="images/fb.png" /></a></p>
<p id='msg'></p>

<script> 
  FB.init({appId: "577876348946753", status: true, cookie: true});

  function postToFeed() {

    // calling the API ...
    var obj = {
      method: 'feed',
      redirect_uri:'https://www.facebook.com/cryswashington?fref=ts',
      link:'https://developers.facebook.com/docs/reference/dialogs/',
      picture: 'http://fbrell.com/f8.jpg',
      name: 'Facebook Dialogs',
      caption: 'Reference Documentation',
      description: 'Using Dialogs to interact with users.'
    };

    function callback(response) {

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

    FB.ui(obj, callback);
  }

</script>