使用API​​在facebook墙上分享?

问题描述:

在我的web应用程序中,我需要一个简单的功能。我有一个URL链接,有一个Facebook按钮,并提示用户将URL分享到他/她的墙上。使用API​​在facebook墙上分享?

在画面enter image description here

+1

那么究竟是什么问题?似乎在这个例子中工作? 你有没有尝试阅读文档:http://developers.facebook.com/,也许你想要什么:http://developers.facebook.com/docs/reference/fbml/wallpost/ – Tjirp

+1

这是一个传统的API,我不会使用它。 –

只需使用window.open或例如具有以下格式URL示出的相似的:

http://facebook.com/share.php?u=http://www.google.com

晒。

+1

谢谢我解决了使用Java脚本API – Asghar

<script type="text/javascript"> 
     function streamPublish(name, description, hrefTitle, hrefLink, userPrompt){   
      FB.ui({ method : 'feed', 
        message: userPrompt, 
        link : hrefLink, 
        caption: hrefTitle, 
        picture: 'http://192.168.1.5/FrostBox1.0/photo/share_photo.jpg' 
      }); 
      //http://developers.facebook.com/docs/reference/dialogs/feed/ 

     } 
     function publishStream(){ 
      streamPublish("Stream Publish", 'Check my public link!', 'Public Link!', 'www.frostbox.com/link', "Public Link to my File"); 
     } 

     function newInvite(){ 
      var receiverUserIds = FB.ui({ 
        method : 'apprequests', 
        message: 'Come on man checkout my applications. visit http://ithinkdiff.net', 
      }, 
      function(receiverUserIds) { 
         console.log("IDS : " + receiverUserIds.request_ids); 
        } 
      ); 
      //http://developers.facebook.com/docs/reference/dialogs/requests/ 
     } 
    </script> 
</head> 

<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script> 
<script type="text/javascript"> 
    FB.init({ 
    appId : 'fffffffffff', 
    status : true, // check login status 
    cookie : true, // enable cookies to allow the server to access the session 
    xfbml : true // parse XFBML 
    }); 

</script> 



<a href="#" onClick="publishStream(); return false;">Publish Wall post using Facebook Javascript</a> 
+1

似乎只是发布一个链接很麻烦,除非你必须从你的Facebook应用程序发布它,当然,这就是客户端的方式。 –

+2

@Asghar:如果用户无法访问您的应用程序,我认为这不会起作用。 –