Currently I'm hitting the API through the JS SDK. What I am trying开发者_开发百科 to do is accomplish is having a like button on my website. But rather than liking the URL you are on..like the fan page. Is this possible?
Yes, it is possible.
With the iframe version: you would assign the href
value to the URL you'd want to like. In your case, the url of the facebook fan page.
<iframe src="http://www.facebook.com/plugins/like.php?href=YOURURLHERE&layout=button_count&show_faces=true&width=450&action=like&colorscheme=light&height=21&locale=en_GB" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:75px; height:21px;" allowTransparency="true"></iframe>
Just make sure you escape the characters in the url correctly. For example:
http://www.facebook.com/yourpage
would become:
http%3A%2F%2Fwww.facebook.com%2Fyourpage
精彩评论