javascript - Detect when user "clicks" the Facebook like button - Stack Overflow

Is it possible to detect when someone clicks the like button "and before the like action really oc

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.

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.

Share Improve this question edited Apr 1, 2021 at 14:49 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked Aug 29, 2011 at 20:28 Mohammed IbrahimMohammed Ibrahim 5701 gold badge5 silver badges16 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

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./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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744704676a4588985.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信