FB.event.subscribe ('comment.create') not working

I try to get a notification when a user comments on the use of a social plugin. The code is as follows:

<fb:comments href='someurl' width='400'></fb:comments> FB.Event.subscribe('comment.create', function(response) { alert(response); } 

Simple but it does not work. Someone got some possible errors? From my online research, it seems that the notification has no real consistency. Sometimes it works, sometimes it doesn’t.

+6
source share
3 answers

Add the notify="true" attribute to the fb:comments tag.

 <fb:comments notify="true" href='someurl' width='400'></fb:comments> FB.Event.subscribe('comment.create', function(response) { alert(response); } 
+5
source

why not close the function call?

FB.Event.subscribe ('comment.create', function (response)
{
warning (response);
});

+4
source

I had the same problems until I came across this answer here:

Methods signed through FB.Event.subscribe for comment.create or comment.remove do not start

You have to put everything related to the FB functions. [...] (FB.init, FB.Event.suscribe, ...) in

window.fbAsyncInit = function () {// your code});

Otherwise, your code will be analyzed before FB js sdk is fully loaded and you will never really sign up for your event.

This may be obvious to many people, but for me and for those who are not familiar with this, that can move you.

+1
source

Source: https://habr.com/ru/post/889169/


All Articles