当我查看html源代码时,我会看到这个javascript代码
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<script >
FB.init({
status: true,
cookie: true,
xfbml: true
});
var username= "gun";
var timenow="1311002200";
var securitykey="ef64ba59d2b0f26d69c94fafb3f008e0";
//pls find a way to capture username either session or something else.
FB.Event.subscribe('edge.create', function(response) {
document.getElementById(response).style.visibility = "hidden";
document.getElementById(response+'1').style.visibility = "visible";
//response will be
$.ajax({
type: "POST",
url: "fbreceive.php",
data: "data="+response + "---" + username+ "---"+securitykey+ "---"+timenow,
//this will post to fb receive as url=http://facebookpagewhichwasliked&user=username
cache: false
});
});
</script>
你能告诉我fbreceive.php包含什么(facebook api的某些人)? 因为没有它,我们所喜欢的网址会再次自动不同......
答案 0 :(得分:1)
FB.Event.subscribe('edge.create',function(){...})是单击Facebook like按钮时触发的回调。对fbreceive.php的ajax调用是跟踪哪个登录用户“喜欢”网站上的哪些内容以及何时(评论也很明确)。用户名和时间表已从用户的会话中捕获,并作为javascript的一部分包含在内。
我会说,这是一个非常巧妙的想法!