Sharing Facebook API

Asked

Viewed 673 times

0

I have a responsive system, where I created a webview for android and Ios with this system to use it as an application. So far ok. So I implemented a Facebook share button as per Facebook documentation (https://developers.facebook.com/docs/sharing/web). I made the implementation by Javascript code.

I implemented for the web because the app is all on the web. In the app is only webview.

It even works, both on the desktop and in the app. However, after I share the app turns the screen all white, it doesn’t go back to my website url.

I believe this happens because when I share on the desktop, opens a facebook pop-up for me to share, and after I share this pop-up closes alone.

So I think this white screen in the app is because this pop-up has closed.

I think it would solve if I pass a redirect url to the Facebook API after sharing it, so I share it and then get redirected to some url.

But searching about it I found nothing in the Facebook documentation or on the Internet.

Could someone help me with some solution?

Thanks in advance!

================================

Follow button code for sharing on Facebook:

<!-- FACEBOOK -->
<div align="center" class="col-xs-8 col-md-8">
    <div align="center" class="fb-share-button" data-href="https://www.site.com<?php echo $_SERVER['PHP_SELF']; ?>" data-layout="button" data-size="small" data-mobile-iframe="false">
        <a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fplugins%2F&amp;src=sdkpreparse" class="fb-xfbml-parse-ignore"></a>
    </div>
</div>
<!-- /FACEBOOK -->

And the Facebook Javascript SDK:

$(document).ready(function() {
    window.fbAsyncInit = function() {
        FB.init({
        appId            : 'APP_ID',
        autoLogAppEvents : true,
        xfbml            : true,
        version          : 'v2.12'
        });
    };

    (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 = "https://connect.facebook.net/en_US/sdk.js";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
});
  • I am not using this parameter no. I haven’t seen it anywhere in the doc. As soon as I get home I post the code. Thank you!

  • @William, I put the codes I’m using to share. I took another look there on the Facebook doc and found nothing related to redirect_uri

  • I followed the process by Debugger but it did not call any file indicating close popup :/ The strange thing is that the doc says that if you pass a parameter called data-mobile-iframe as true, on mobile devices it uses an iframe instead of opening the pop up, but even passing this parameter as true it looks the same way. But when I open the site by smartphone browser it works. It opens the pop up, I type something or leave blank and click confirm, then it opens a new tab just asking if it confirms the share. I think this new tab that does not work in the webview

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.