Question

I'm a newbie regarding this kind of coding, and I would really appreciate your help. However, I would like to know if it's possible to make the share button return a boolean which gives true once the content has been shared.

I need it cause my website is about winning various stuff and the sharing action will give points to users.

Ps. My script is in php.

Thanks in advance, bye.

Was it helpful?

Solution

Yes, the Facebook JavaScript API takes a callback that indicates if the post was successful:

FB.api( '/{page-id}/feed', 'POST', {
        message: 'Check out this cool link!',
        link: 'http://coollink.com'
    },
    function (response) {
        if (response && !response.error) {
            // post successful
        } else {
            // post unsuccessful
        }
    }
);

Documentation here: https://developers.facebook.com/docs/graph-api/reference/page/feed/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top