我有一个网站,在上面有一个名为“分享”的Facebook按钮。我希望当用户点击该按钮时,我的网页内容可以分享到他的Facebook页面上。我的代码如下所示:
<script>
function fbs_click(){
u = location.href;
t = document.title;
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>
我知道你的内容页面或网站名称的t=title
和u=url
也在body标签中。
<a rel="nofollow" href="http://www.facebook.com/share.php?u=http://lums.edu.pk/event-detail/lecture-on-citation-management-and-referencing-1133"
class="fb_share_button" onclick="return fbs_click()" target="_blank"
style="text-decoration:none;">Share</a>
?u是我想要分享的链接。 这段代码可以为我打开一个分享页面,只分享我的网址而不是我的页面内容。我的内容包括图片、标题和详情(我从数据库表中获取这些值)。请有人帮帮我。