Facebook share does not close the window popup

10,620

Solution 1

Was having the same problem, and came across the "feed dialog" - seems to have replaced the "sharer" functionality:

http://developers.facebook.com/docs/reference/dialogs/feed/

Solution 2

Please do not use the deprecated sharer.php. It might be totally removed from Facebook at any moment.

You should use the like or send plugin in it's place: http://developers.facebook.com/docs/reference/plugins/like/

Solution 3

I've been working on this FB share button recently and I found the same issue. What I did was to switch to the Feed Dialog (as mentioned here), but you have to specify the app_id and rederect_uri. Jeremy provided a solution to close the window after you hit the share button (FB.ui popup window doesn't close).

Actually if you go to Digg's website and check out their facebook button, it's a Feed Dialog indeed and they just specified a redirect_uri with a simple JavaScript window.close.

But please be aware of the differences beetween FB share button and FB like button: FB like button will only be used once by the same account for the same link, while the FB share button allows anyone to share the same link for multiple times.

Solution 4

If you use this undocumented URL for sharer.php, it will close the popup/window for you:

http://www.facebook.com/sharer.php?=100&p[url]=<url-to-share>

The popup will close itself. Make sure you URI encode the url to share. sharer.php will scrape the page for the og tags to get the title, image, etc.

Share:
10,620
Ponja
Author by

Ponja

Updated on June 28, 2022

Comments

  • Ponja
    Ponja almost 2 years

    this is my code, as you can see it's very simple. there is an anchor that call a javascript method, and this opens a facebook popup shareing.

    the problem is that the popup is not being closed after the user submit the comment.

    <script language="javascript" type="text/javascript">
        function fbs_click() { 
        u = location.href; 
        t = document.title; 
        window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) + '&t=' + encodeURIComponent(t) + '&redirect_uri=' + encodeURIComponent('http://www2.highpoint.edu/close_popup.php'), 'sharer', 'toolbar=0,status=0,width=656,height=436'); return false; }
    </script>
    <a id="share-facebook" class="shareLink" href="http://www.facebook.com/share.php?u=<url>" onclick="return fbs_click()" target="_blank">Facebook</a>
    

    can you help me please?