检测用户何时单击“点击".Facebook赞按钮 [英] Detect when user "clicks" the Facebook like button

查看:67
本文介绍了检测用户何时单击“点击".Facebook赞按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能检测到某人何时在喜欢动作真正发生之前"点击喜欢按钮,即与 onSubmit JS事件相同,它可以检测用户何时提交表单,甚至还没有提交表单,从而能够在表单提交之前处理/运行一些代码.

Is it possible to detect when someone clicks the like button "and before the like action really occurs", i.e. same as onSubmit JS event, it detects when the user submit the form before it even get submitted, giving the ability to process/run some code before it do so.

用法:
我正在尝试实现一个Web 2.0页面,其中所有操作都发生在一个页面中,因此根据用户操作,页面的内容将更改为但不是meta"

Usage:
I am trying to implement a Web 2.0 page where all the action happens in one page, so depending on the user actions the content of the page would change "But not the meta"

因此,我的问题是,我是否可以检测到用户何时点击"广告,赞按钮,这样我就可以加载"真正执行喜欢"操作之前的当前页面的元数据?

So my question is, can I detect when the user "clicks" the like button so I can "load" the meta of the current page before the like action really happens?

PS,我确实知道加载元数据并不重要,因为它小于1KB,不会有任何效果,但是我很好奇是否有任何方法/解决方法.

P.S, I do know that it's not a big deal to load the meta as it's less than 1KB and won't have any effect, however I am just curious if there is any way/ work around to do so.

推荐答案

您可以订阅一个事件,该事件将在用户喜欢某些内容时通知您-但这将在操作后触发.记录在以下位置: http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/

You can subscribe to an event that will notify you when the user likes something - however this will fire after the action. This is documented at: http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/

一个例子是:

FB.Event.subscribe('edge.create', function(response) { alert('You liked the URL: ' + response); /* check the response here to see if it's your URL */ });

您可以尝试拦截操作,但是为什么要等待添加元数据呢?您是说打开图形标题吗?Facebook每隔24小时就会抓取一次,而不是针对每个独特事件进行抓取.同样,很可能违反Facebook的条款来拦截/更改类似行为,因为您会干扰他们既定和预期的准则.

You could attempt to intercept the action but why would you want to wait to add the meta? Do you mean the open graph headers? Facebook scrapes these every 24-hours, not for each unique like event. Also it would most likely be against Facebook's terms to intercept/alter the like action, as you'd be interfering with their established and expected guidelines.

这篇关于检测用户何时单击“点击".Facebook赞按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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