2012-07-04 30 views

回答

1

不幸的是,获取这些信息需要安装。既然您提到您使用的是Blogger,那么您几乎可以使用JavaScript。

要做的最好的事情是确保他们已经在之前安装了他们点击了“赞”按钮,因为这样会更容易处理。安装看起来像这样(使用一些jQuery的太多,为了简洁):

<div id="fb-root"></div> 
<script src="//connect.facebook.net/en_US/all.js" type="text/javascript"> 
<script type="text/javascript"> 
    FB.init({ 
     appId  : 'YOUR_APP_ID', // App ID 
     status  : true, // check login status 
    }); 

    $('#button').click(function(evt) 
    { 
     FB.login(function(response) 
     { 
      if (response.authResponse) 
      { 
       // yay! logged in! 
      } 
     }); 
    }); 

现在你已经为安装,所有你需要做的是钩到“像”事件。

FB.Event.subscribe("edge.create", function(url) 
{ 
    FB.getLoginStatus(function(response) 
    { 
     if (response.status === 'connected') 
     { 
      var userId = response.authResponse.userID; 

      // you now have the userId and the URL of the object they liked. 
     } 
    } 
}); 

一旦你有一个用户名和URL,就可以某处火了一个AJAX请求,这样可以保持跟踪谁喜欢什么。

更多的文档:

+0

非常感谢你。 :) –

相关问题