I am trying to understand what exactly is the difference between fbml and xfbml! Is XFBML same as FBML combined with java script?
2 Answers
FBML is a facebook's propriety mark-up language, and originally all app views were static rendered in just FBML. Developers wanted to make their facebook app views more dynamic though, but they couldn't use javscript in FBML, so facebook created FBJS to allow developers to make their pages dynamic.
Later, they added support for iframe views, which originally were just HTML. Finally, they added support for embedding FBML tags in a regular document using XFBML. So using your analogy above, it's more like HTML + FBML = XFBML.
In any case, both static FBML and FBJS are both being deprecated any will eventually be removed entirely, so it would be a bad idea to use either of them. XFBML can still be rendered using the Facebook Javascript API, so it's not as bad an idea to use XFBML, but still not the best idea. Regular HTMl and javascript combined with the Facebook Javascript API can do everything XFBML can do, and it can do it more cleanly.

- 52,489
- 13
- 125
- 145
-
1FBML did not have iframe view support in initial days. Later they added it but they could not still allow fbml tags inside the iframes. Finally they allowed fbml tags inside iframes. Did I get your idea right? – Karthick Jan 18 '11 at 18:26
-
@Karthick, no that's not really it. When you create a new facebook application, you have two options to choose from for the "canvas": IFrame or FBML. These are distinct options completely different from each other. If you choose FBML, then all your views must be in FMBL (or FBJS). If you choose IFrame, then all your views must be HTML (but optionally these can include XFMBL tags). But as I said, FMBL is being deprecated -- all new apps should be iframe apps. – Ben Lee Jan 18 '11 at 18:30
-
oh.. great.. I got it. But still I am not able to understand where the api calls are made. Eg. in an iframe application, if you embed the fbml tag, then where is the api call actually? – Karthick Jan 18 '11 at 18:45
-
1@Karthick, first you must inlcude the Facebook Javascript API. See http://developers.facebook.com/docs/reference/javascript/ for how to do it. After that, I'd recommend doing *everything* through javascript without any FBML tags at all. If you must use FBML tags, then you can render them using `FB.XFBML.parse();`. See this: http://developers.facebook.com/docs/reference/javascript/fb.xfbml.parse/ – Ben Lee Jan 18 '11 at 18:53
-
In an iframe if I use fbml, how does the facebook server know that it should take that and parse it to html? i.e. if I use a fbml alone, then i specify the mode. But if iframe is used, the facebook server doesnt care what's inside iframe rite? – Karthick Jan 18 '11 at 18:58
-
Well if you use iframe, it renders just as html would normally render. Please see my comment above. Facebook is not responsible for rendering any fbml tags in your iframe -- *you* are responsible for it. You can do it by calling the javascript function `FB.XFBML.parse()` which is supplied by the Facebook Javascript API. Please read the javascript api docs if you have any further quesitons on this -- they cover everything you need to know. – Ben Lee Jan 18 '11 at 19:02
No.
FBML is the old markup language which was proxied through Facebook servers and re-written into HTML that was rendered as your app. FBJS is a subset of JS that you could use in FBML pages. It was also proxied and rewritten by the facebook servers. FBML has been deprecated for some time.
XFBML is code that is served directly from your server to end users in an iframe, then processed client-side by Facebook-provided javascript to generate facebook-specific UI elements. It reduces page load time and the CPU load on Facebook's servers because they don't have to proxy and process everything.

- 27,203
- 20
- 110
- 132