Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

Is anyone aware of a Facebook 'like' button implementation that doesn't use an iframe? I'd like to use the like button, but currently can't due to accessibility requirements.

share|improve this question

3 Answers 3

You can use the Facebook SDK to do this without an iFrame.

There are two Like button implementations: XFBML and Iframe. The XFBML version is more versatile, but requires use of the JavaScript SDK. The XFBML dynamically re-sizes its height according to whether there are profile pictures to display, gives you the ability (through the Javascript library) to listen for like events so that you know in real time when a user clicks the Like button, and it always gives the user the ability to add an optional comment to the like. If users do add a comment, the story published back to Facebook is given more prominence.
-From http://developers.facebook.com/docs/reference/plugins/like

Its pretty easy to implement.

share|improve this answer
1  
Hmmmm... XFBML definitely looks like an option, but I'm put off by the XHTML requirement (currently serving HTML) and the need to register each page as a 'facebook application', which seems like massive overkill. Unless I'm misunderstanding it ... –  Bobby Jack Aug 17 '10 at 10:22
5  
The XFBML version of the Like button is transformed into an IFrame by facebook's Javascript code, so you'll end up with an IFrame on your page either way. –  Benjamin Wohlwend Aug 17 '10 at 14:16
    
Back to square one, then! :-) –  Bobby Jack Aug 17 '10 at 17:34
    
This is unbelievable. –  Henrik Mar 1 '13 at 11:09

It is impossible for you to know which Facebook user is viewing your page, so you can't display which users have also liked the content. If you could, that would be a ridiculous security hole.

The only way to do that is to have an iframe to Facebook's site, and then Facebook shows you which friends have liked the page.

The best you can do is pull the number of likes from the Graph API.

share|improve this answer
2  
That makes sense, but isn't there a version that a) allows the user to 'like' the page (that's just a plain link, I assume) and b) show the number of likes? –  Bobby Jack Aug 20 '10 at 9:13

I haven't tried this, but you could have a link for the adding a like, something like

https://www.facebook.com/connect/uiserver.php?social_plugin=like&method=opt.inlike&display=popup&secure=true&app_id=127760087237610&protocol=https%3A&external_page_url=<YOURURL>&nux=true&referer=<YOURURL>

Then use cURL from command line or something similar to get the number of likes from Facebook

https://api.facebook.com/method/fql.query?query=select%20like_count%20from%20link_stat%20where%20url=%27<YOURURL>%27&format=xml

share|improve this answer

protected by Community Jan 8 '12 at 15:05

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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