Facebook图表api确定用户是否喜欢url [英] facebook graph api determine if user likes url

查看:113
本文介绍了Facebook图表api确定用户是否喜欢url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果用户当前登录到Facebook并喜欢当前页面,我想显示不同的消息。我明白:

I want to display a different message if a user is currently logged in to facebook and likes the current page. I understand:

FB.Event.subscribe('edge.create', function(response) {
    // you like this
});

当用户喜欢该页面时会触发,但是当您重新加载页面时,您如何确定已经像当前页面一样?

Which will fire when a user likes the page, but when you reload the page how do you determine they already like the current page?

谢谢!

推荐答案

很确定你不能做你想要的(在这种情况下)。

I'm pretty sure you cant do what you want (in this context).

看看这个页面: http://fbrell.com/fb.api/does-like

看到您需要用户批准权限才能查看喜欢的内容。

You'll see you need the user to approve a permission to view the likes.

允许某人看到用户的喜欢(即使是当前页面)也是一个巨大的安全隐患。想想你可以轻松地欺骗当前的页面,并假装是任何页面。

It's a huge security risk to allow someone to see the 'likes' of a user - even for the current page. Think about it you can easily spoof the current page and pretend to be any page.

但是...

我建议你做的只是设置一个cookie为您自己的利益(在javascript中)当用户喜欢你的页面。假设您从该页面获得了大部分的喜欢,那么您可以安全地将Cookie的存在与喜欢关联。

What I recommend you do is just set a cookie for your own benefit (in javascript) when the user 'Likes' your page. Assuming you're getting a large percentage of your 'Likes' from this page then you can safely correlate the presence of the cookie with a 'Like'.

看到一些安全例外,但似乎有效(至少在Chrome中)。

I've seen some security exceptions doing this, but it seems to work (at least in Chrome).

这篇关于Facebook图表api确定用户是否喜欢url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆