检测用户何时“点击” Facebook 点赞按钮

发布于 2024-12-01 21:17:28 字数 338 浏览 0 评论 0原文

是否可以检测到有人单击“喜欢”按钮“以及在“喜欢”操作真正发生之前”, 即与 onSubmit JS 事件相同,它会在用户提交表单之前检测用户何时提交表单,从而能够在提交之前处理/运行一些代码。

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

所以我的问题是,我是否可以检测用户何时“单击“喜欢按钮,这样我就可以在喜欢操作真正发生之前“加载”当前页面的元数据?

PS,我确实知道加载元数据并不是什么大问题,因为它小于 1KB 并且不会产生任何影响,但是我只是好奇是否有任何方法/解决办法可以做到这一点。

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.

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?

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千里故人稀 2024-12-08 21:17:28

您可以订阅一个事件,该事件将在用户喜欢某些内容时通知您 - 但是这将在操作后触发。这记录在: 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 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/

An example would be:

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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文