我是新来的twitter,facebook等api的和JavaScript的。试图分享一个链接到Facebook只分享主要网址
其他人可能会问一个类似的问题,但请检查我的问题,我猜这个问题不是重复的。
我正在尝试分享到Facebook的网址。这里是我的代码
<?php $link="www.google.com">
<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>
<style>
html .fb_share_button { display: -moz-inline-block; display:inline-block; padding:1px 20px 0 5px; height:15px; background:url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?6:26981) no-repeat top right; } html .fb_share_button:hover { color:#fff; url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?6:26981) no-repeat top right; text-decoration:none; }
</style>
<a rel="nofollow" href="http://www.facebook.com/share.php?u=<?php echo $link;?>"
class="fb_share_button" onclick="return fbs_click()" target="_blank" style="text-align:center;"></a>
</div>
但不是分享www.google.com
它显示主网址如www.mysite.com/facebookshare.php
我要去错在何处。
我也试过一个简单的锚标记方法来分享,但它扰乱了我的整个CSS。 〔实施例
<a href = "http://www.facebook.com/sharer/sharer.php?u= <?php echo $link;?>">
<img src = "http://www.mysite.com/FB_2.png"></a>
请帮我得到确切的网址我希望(www.google.com)中被共享到Facebook。
谢谢
雅得到它。谢谢@Jessie –