2016-10-12 71 views
1

我有一個片段,允許我的MVC Asp.net站點上的用戶發佈POST。它工作正常。獲取Facebook用戶的用戶ID

我需要什麼是POST發佈時,Facebook用戶點擊它(如果用戶點擊它,有一個url操作會將您帶到mywebsite)。我將如何獲得userId或其他指示XXXX Facebook用戶點擊的東西?

一旦我的網站上的用戶發佈了這篇文章,朋友可以點擊鏈接,我想知道用戶點擊了它。

function facebookShare() 
 

 
    { 
 

 
     FB.ui({ 
 

 
      method: 'feed', 
 

 
      name: "My gallery - Price: $49.99", 
 

 
      link: "https://mygallery.net/Product/Details/99", 
 

 
      picture: "http://mygallery.com//Images/Products/image.jpg", 
 

 
      description: "In the last 100 years of....", 
 

 
      caption: "Product Name: Awesome Pix-X", 
 

 
      quote:"Quote: You will always be mine!" 
 

 
     }, 
 

 
    
 

 
     function (response) 
 

 
     { 
 

 
      if (response && !response.error_message) { 
 

 
       alert('post_id : ' + response.post_id); 
 

 
      } else { 
 

 
       alert('Error while posting.'); 
 

 
      } 
 

 
    
 

 
     }); 
 

 
    
 

 
    } 
 

 

那麼我這裏添加的查詢參數動態獲取誰點擊它Facebook的用戶? 鏈接:「https://mygallery.net/Product/Details/99」,

回答

1

如果用戶沒有授權您的應用程序,則無法知道。例如,如果他授權你的應用,你可以通過FB.getLoginStatus得到他的身份證。

+0

好的。我以爲你可以動態添加用戶標識到鏈接。那麼我可以使用FB.getLoginStatus來檢查用戶是否已授權應用程序。如果沒有,那麼我顯示FB.login函數。 – DavidJS