2011-09-19 84 views
0

在我的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,我不會使用它。 –

回答

1
<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:如果用戶無法訪問您的應用程序,我認爲這不會起作用。 –

相關問題