Search code examples
facebookfacebook-sharer

Close facebook share popup after share is complete?


I'm attempting to share a link on facebook via url. I get the share to work, however instead of loading the redirectURI, I want to close the popup window. My code:

function fb_share(url) { window.open(url,"share_window","width=400,height=300"); }
...
fb_share('http://www.facebook.com/dialog/feed?app_id=128000000000&link=http%3a%2f%2fwww.facebook.com%2fapps%2fapplication.php%3fid%128000000000%26sk%128000000000&picture=http://www.google.com/images/nav_logo83.png&name=name&description=description&redirect_uri=http%3a%2f%2fwww.facebook.com%2fapps%2fapplication.php%3fid%3d128398017257108%26sk%3dapp_128000000000&display=popup')

Solution

  • I wrote a page that can be used as the redirect_uri, which will close popup via javascript: http://www2.highpoint.edu/close_popup.php

    View the source to see some simple HTML:

    <!doctype html>
    <html>
      <h3>Thank you!</h3>
      <a href="javascript:close();">Close this window</a>
      <script type="text/javascript">
        close();
      </script>
    </html>
    

    It works when used as the callback from a Facebook Dialog.