如何在Facebook上分享我的网站的内容
我有一个网站,我有一个名为share的Facebook按钮。我想要的是,当用户点击该按钮时,我的网页的内容应该在他的墙上分享。我的代码就像我头上的页面标签:
I have a website and on that I have a facebook button named as share. I want that when user clicks on that button the content of my webpage should share on his wall. My code is like this in my head tag of page:
<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>
我也知道 u = url
您的内容页面 t = title
或网站名称,这在正文标签内:
I also know that u= url
of your content page t= title
or site name and this is inside the body tag:
<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 is the link I want to share. This code open a share page for me, and share just my url not the content of my page. My content includes an image, tittle and detail (I'm fetching these values from database table). Please some one help me.
最后我得到了我的解决方案。这是为我做的工作的实际代码。我是错误的处理我的链接。它应该是这样的
Finally I got my solution.This is actual code that is doing job for me . I was mis handleing ?u of my link.It should be like this
?u=http%3A%2F%2Fmywebsite.com%2Fcontent+of+my+page" target="_blank">this link</a>