Callback function with new Facebook Share button

I am trying to sign up for the "edge.create" event in conjunction with the new Facebook Share button with no luck. I use a standard event subscription:

FB.Event.subscribe('edge.create',
    function(response) {
        console.log(response);
    }
);

The event does not fire ... It works instead of the Favorites button

Any suggestion?

+4
source share
2 answers

The facebook share button has been deprecated in favor of a similar button. From your documents:

The Share button has been deprecated in favor of the Like button and will no longer be supported. Use the "Like" button each time you can control the maximum traffic in your applications.

, , , javascript. click FB.

, .

window.fbAsyncInit = function () {
    FB.init({
        appId: 'your app id',
        status: true,
        cookie: true,
        xfbml: true,
        oauth: true
    });

    $('#facebook-share').click(function () {
        FB.ui({
            method: 'feed',
            link: document.URL,
            caption: 'example',
        }, function (response) {
            if (response === null) {
                console.log('post was not shared');
            } else {
                console.log('post was shared');
            }
        });
    });
};

(function (d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.async = true;
    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
+4

facebook , ...

, , APP , :

   jQuery("#div_share").click(function() {

        var url = "http://www.facebook.com/sharer/sharer.php?u=YOUR_URL&title=YOUR_TITLE";

        var openDialog = function(uri, name, options, closeCallback) {
            var win = window.open(uri, name, options);
            var interval = window.setInterval(function() {
                try {
                    if (win == null || win.closed) {
                        window.clearInterval(interval);
                        closeCallback(win);
                    }
                }
                catch (e) {
                }
            }, 1000);
            return win;
        };

        openDialog(url,'Facebook','width=640,height=580', function(){
            jQuery("#div_share").hide();
            jQuery("#formulario").show();
        });
    });

javascript , . , ... ..:)

0

All Articles