Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

just a quick question, is it possible to create an FB Like button in plain HTML?

I checked out the Like button code dircetly cerated by developers.FB but it's an

<iframe src="http://www.facebook.com/plugins/like.php?href=...></iframe>

I also checked out the addthis.com and it's a bunch of Javascript.

I mean: is there a way to just use something simple? Example:

<a href="http://www.facebook.com...?page=my-fb-page..." rel="nofollow">FB like, click here</a>

I know in this way it won't show anymore "how many people like", but I don't mind this, I just want something simple, so I can use my own icon or text, etc.

In my understanding for the Share button is possible by just adding:

<a href="http://www.facebook.com/share.php?u=your-percent-encoded-url-of-your-site-page.hmtl">To share on FB click here.</a>

So i suppose it could be possible also for the Like button.

share|improve this question

2 Answers 2

up vote 8 down vote accepted
+50

I don't believe that this can be done. The code for the like button has to identify if you are logged into an account and if so rather or not you've liked the topic already. This couldn't be done in plane HTML. The closest you could get is the iframe that you mentioned.

share|improve this answer
    
As a long time FB dev, I'm just here to confirm what Adam wrote. There is no way to do this without the iframe HTML tag or fb:like FBML tag. –  Matt Huggins Dec 6 '10 at 19:13
    
I think you are right I looked in <iframe> source generated by FB, but it's a mess of javascript. I hope to find a simp,e plain HTML link there, but nothing. –  Marco Demaio Dec 6 '10 at 20:42
    
It might be required due to FB's implementation, but neither of the things mentioned here require JavaScript. It could all be done server-side. The only thing you wouldn't be able to do is use AJAX to like the page without reloading or display real-time like counts. –  Lèse majesté Dec 12 '10 at 1:22
    
@Lese majeste: what do you mean server-side? –  Marco Demaio Dec 13 '10 at 22:51
1  
Ah, I got you. I think that maybe he's talking about using Facebook's PHP API. Basically you can use what they call the social graph to interact with Facebook. This is all done through PHP code. As bit of an example take a look at the Facebook Developers site: developers.facebook.com/docs/guides/web#personalization –  Adam Thompson Dec 14 '10 at 18:39

A sort of work around could be to create also a FB page for your website, then you add a small FB icon on your website that links to the FB page. :)

It wouldn't be as trivial for final user as clicking the FB "Like button", cause it would have to visit your FB page and then click the Like button over there.

At least for FB we have this sort of work around, for Google +1 button there seems to be no way other than including their API.

As a side note, I have to say that it's quite irritating to almost be forced to place all these JS code from Google + FB on my pages, they could sniff/track visits and other stuff on my sites, but I suppose we have no more chances to avoid adding such buttons in now days. :(

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.