JS:检测用户何时“点击” facebook喜欢按钮 [英] JS: Detect when user "clicks" the facebook like button

查看:148
本文介绍了JS:检测用户何时“点击” 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页面,其中所有的操作都发生在一个页面,因此根据用户操作页面的内容将改变但不是元

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.

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

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