3

In the parent page, I have a share button to call FB.ui(). I click the button and FB share modal popup as a separate window, then I close my parent page. Go back to my FB share window and share the content to fb wall. After I click the share button, the window becomes a white page(the url is https://www.facebook.com/dialog/feed). And the callback of FB.ui() is not called.

Do we have a solution? at least I want to have the callback work. I tried to add "redirect_uri" as it is proposed in this post FB.ui feed not giving a callback, but it doesn't change anything.

/* FB init */
window.fbAsyncInit = function() {
    FB.init({
        appId  : '',
        status : false,
        xfbml  : false,
    });
};

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

shareButton.on('click', function(e) {
    submitPost();
});

/* the function for share*/
    function submitPost() {
        FB.ui({
            method: 'feed',
            name: '',
            link: '',
            picture: '',
            caption: '',
            description: '',
        }, function(response) {
            if (response && response.post_id) {
                // do something
            }
        });
    }
Community
  • 1
  • 1
user1735940
  • 123
  • 1
  • 7
  • How can one understand what's happening unless we see your code – Sahil Mittal Apr 23 '14 at 07:57
  • Where are you calling `submitPost`? I cant see that in the code – Sahil Mittal Apr 23 '14 at 18:12
  • Thanks, I added my code. Actually it works fine in normal flow, the corner case is if I open FB share window and then close the parent page, then I click "share" in FB window, the post is shared but the callback is not happen and the window goes to a blank page. – user1735940 Apr 23 '14 at 18:16
  • Why are you closing the parent window? – Sahil Mittal Apr 23 '14 at 18:24
  • It is a possible behavior from users. I want to do something after user share the post, but in this case, the callback not happen so it breaks the expected flow. – user1735940 Apr 23 '14 at 18:31
  • I dont think this case will ever happen! Why will user close the parent window while popup is still active. Anyways, in that case you cant do anything. Since the page is destroyed, alongwith it the code behind it is also destroyed; so why will the callback take place. – Sahil Mittal Apr 23 '14 at 18:35
  • I understand the page is destroyed. I am looking for some alternative way to do share with callback. Someone said redirect_uri works for them, but it doesn't work for me. – user1735940 Apr 23 '14 at 18:55
  • I'm closing the dialog using a little bit of jQuery: http://stackoverflow.com/questions/27000726/after-fb-ui-feed-popup-dont-close-after-send-post/28249421#28249421 – Thomas Bindzus Jan 31 '15 at 08:04

1 Answers1

1

Found a solution: Use an old version of FB Javascript SDK (2012), and add "redirect_uri". FB.ui feed not giving a callback

    FB.ui({
        method: 'feed',
        name: '',
        link: '',
        picture: '',
        caption: '',
        description: '',
        redirect_uri:'http://.../self.close.html'
    });
Community
  • 1
  • 1
user1735940
  • 123
  • 1
  • 7