Passing Custom Variable at End of URL in facebook.com/sharer not working
I'm trying to add a facebook share button to my page
Here's the code
<a href="http://ww开发者_如何学编程w.facebook.com/sharer.php?u=http://www.test.com/default.aspx?S=Facebook&SID=3688"
Now when the share the link of facebook, I lose &SID=3688
Any ideas on why this is happening?
URL Encode your href value, then you shouldn't "lose" anything.
You should encode this u=http://www.test.com/default.aspx?S=Facebook&SID=3688
because facebook gates value in a same way as your site by using query string.
Feel free to create your own implementation based on this. Make sure you URL encode the u and t parameters -- use the JavaScript function encodeURIComponent()
. For example:
http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.sadtrombone.com%2F&t=Sad%20
精彩评论