Multiple Facebook Shares on One Page

I have a daily deal aggregator site and i can’t get the Facebook share to work properly. There are lots of deals on each page and each one has it’s own FB share so they can post it on their wall, friends walls etc.

here is the site so you can try the share: http://bit.ly/xFGzj5

  • Facebook Connect 'next' error
  • Failed to execute 'postMessage' on 'DOMWindow': The target origin provided does not match the recipient window's origin ('null')
  • How to Handle Facebook Application Requests?
  • In what ways is JavaScript restricted when making a Facebook app?
  • FB.login Javascript changes needed by October?
  • How do you autopublish with FB.UI?
  • Here is the code Im using now:

    <!-- Each Deal has this button that links to FB -->
    <a href="http://www.facebook.com/share.php?u=<?php echo urlencode($shareurl); ?>" onclick="return fbs_click('<?php echo urlencode($shareurl); ?>','<?php echo $title; ?>')" target="_blank"><img src="../../images/fb.png" border="0" alt="Share On Facebook" class="smicon" /></a>
    
    <!--And here is the JS function:-->
    
    <script>
    function fbs_click(u,t) {
    window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
    return false;
    }
    </script>
    

    With this method, right now the title is not working properly, and sometimes an image shows up, sometimes it doesn’t. When an image does show there are about 200 thumbnails to choose from (depending on how many deals are on the page) so the user has to cycle through it until they find the right one.

    Ideally, I want the url/title working properly (obviously) and have the image go to that specific deal’s image by default when they click the share button. Anyone have any ideas on how to make this work???

  • How does Facebook set Cookies with FB Init call in “Facebook Connect” setup?
  • WAMP vs. Live server facebook connect
  • Advanced Matching with New Facebook Pixel in Javascript Web App
  • ReactJs - Creating an “If” component… a good idea?
  • How to fetch profile picture from facebook javascript SDK?
  • Signup with Facebook JS SDK
  • 2 Solutions collect form web for “Multiple Facebook Shares on One Page”

    why are you taking this approach?
    i recommend using either the social widgets or the javascript sdk fb provides.

    for example, with the js sdk you can do this: https://developers.facebook.com/docs/reference/dialogs/send/

    as for the social widgets, you can add a like for each item:
    https://developers.facebook.com/docs/reference/plugins/like/

    or send button:
    https://developers.facebook.com/docs/reference/plugins/send/

    Just remember to have the JS Function only once on your main page, otherwise it is loaded every time a page loads. That will prevent the images from disappearing.
    In .NET I added all the FB funcion-scripts in the Site.master page and it works fine.