FBML Versions

Problem

I know there are different versions of FBML and some tags require FBML 1.1, but how do I set or even know which version I’m using?

Solution

Wrap your FBML in fb:fbml tags and specify a version you want them executed with:

<fb:fbml version="1.1">
    <!-- FBML Here -->
</fb:fbml>

Discussion

You can include an fb:fbmlversion tag inside an fb:fbml tag to output which version is being used to parse that content, though you should note that this is really only intended for debugging purposes. As an example, the following:

<fb:fbml version="1.0">
    <p>This is <fb:fbmlversion /></p>
</fb:fbml>
<fb:fbml version="1.1">
    <p>This is <fb:fbmlversion /></p>
</fb:fbml>
<fb:fbml version="1.2">
    <p>This is <fb:fbmlversion /></p>
</fb:fbml>

will give you:

This is 1.0
This is 1.1

You might have expected to get a third paragraph for 1.2, but the FBML parser ignores it because that version didn’t exist at the time this book was written. Using an fb:fbmlversion tag outside of an explicit fb:fbml tag should give you 1.0, since that’s the assumed default if you haven’t specified otherwise.

Get Facebook Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.