Tom Gullen
Tom Gullen

Reputation: 61775

Trouble implementing Facebook 'like' button

This is the code I'm putting on my website:

<iframe src="http://www.facebook.com/plugins/like.php?app_id=5766773068&amp;href&amp;send=false&amp;layout=standard&amp;width=47&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:47px; height:35px;" allowTransparency="true"></iframe>

An implemented example URL is:

http://www.scirra.com/blog

Whenever I press 'like', nothing seems to happen, and if I expand the frame size to see what is happened it just says 'error'.

I keep trying to use:

http://developers.facebook.com/docs/reference/plugins/like/

But it is really temperamental sometimes giving me code other times not. Do I have to specify the URL? I was under the assumption this was not needed to 'like' the current page.

Please note on my homepage the like button works fine, but the url is specified. So can anyone see what I'm doing wrong?

Upvotes: 0

Views: 798

Answers (2)

phadej
phadej

Reputation: 12133

You don't have href argument set in the src parameter of iframe.

Compare yours code

...766773068&amp;href&amp;send=false&a...

with generated

...76677306&amp;href=http%3A%2F%2Fwww.scirra.com%2Fblog&amp;send=false&a...

Upvotes: 1

Matthew Johnston
Matthew Johnston

Reputation: 4439

As phadej has noted, you are missing the href attribute from your iFrame call. The thing to note from the Like button documentation is this:

href - the URL to like. The XFBML version defaults to the current page.

You are using the iFrame version, so this is why you must include href

A useful tool that you might like to bookmark is the Facebook URL linter which will show you any errors in your Open Graph tags or missing information, as well as try and help you figure out anything that is going wrong.

Upvotes: 5

Related Questions