JS: Detect when user “clicks” the facebook like button

前端 未结 1 2021
一向
一向 2021-01-18 21:33

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 th

相关标签:
1条回答
  • 2021-01-18 21:57

    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.

    0 讨论(0)
提交回复
热议问题