admin管理员组文章数量:1426609
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
2 Answers
Reset to default 0why 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.
本文标签: javascriptMultiple Facebook Shares on One PageStack Overflow
版权声明:本文标题:javascript - Multiple Facebook Shares on One Page - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745482405a2660234.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论