Skawful
Skawful

Reputation: 9927

Facebook: User Like/Become fan of page

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

Answers (3)

quest
quest

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&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;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

binit
binit

Reputation: 476

It is not possible through the Facebook APIs. Above iframe solution might work.

Upvotes: 0

gunwin
gunwin

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&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=dark&amp;height=80"></iframe>

Take note of the: http%3A%2F%2Fwww.yoursiteurlencodedhere.com section.

Upvotes: 1

Related Questions