javascript - Multiple Facebook Shares on One Page - Stack Overflow

I have a daily deal aggregator site and i can't get the Facebook share to work properly. There are

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:

Here is the code Im using now:

<!-- Each Deal has this button that links to FB -->
<a href=".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('.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???

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

Here is the code Im using now:

<!-- Each Deal has this button that links to FB -->
<a href="http://www.facebook./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./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???

Share Improve this question asked Feb 14, 2012 at 15:42 Curtis MangioneCurtis Mangione 331 gold badge1 silver badge3 bronze badges 1
  • It must take forever to load too. Each "like" opens up its own iframe and connection back to FB. – Diodeus - James MacFarlane Commented Feb 14, 2012 at 15:45
Add a ment  | 

2 Answers 2

Reset to default 0

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

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

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

or send button: https://developers.facebook./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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745482405a4629618.html

相关推荐

  • javascript - Multiple Facebook Shares on One Page - Stack Overflow

    I have a daily deal aggregator site and i can't get the Facebook share to work properly. There are

    3小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信