Reputation: 9927
In any facebook api (connect, graph, rest, etc) is there a way to prompt the user to become a fan of a page (now known as liking a page).
Upvotes: 5
Views: 507
Reputation: 776
Here's the details for adding a Facebook like button.
http://developers.facebook.com/docs/reference/plugins/like/
You can use the iframe method:
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fexample.com%2Fpage%2Fto%2Flike&layout=standard&show_faces=true&width=450&action=like&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>
Or you can use the xfbml method:
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like show_faces="true" width="450"></fb:like>
Personally I think the xfbml method is cleaner. Unfortunately this doesn't actively prompt the user, it merely adds the button to your page. There is no way in their api to prompt someone.
Upvotes: 0
Reputation: 476
It is not possible through the Facebook APIs. Above iframe solution might work.
Upvotes: 0
Reputation: 4832
<iframe frameborder="0" scrolling="no" allowtransparency="true" style="border: medium none; overflow: hidden; width: 150px; height: 20px;" src=" http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.yoursiteurlencodedhere.com&layout=standard&show_faces=true&width=450&action=like&colorscheme=dark&height=80"></iframe>
Take note of the: http%3A%2F%2Fwww.yoursiteurlencodedhere.com section.
Upvotes: 1