FBML and HTML validation

FBML (FaceBook Markup Language) is a markup language proposed by Facebook to extend some of the core functionalities of the social network itself. In its simplest form, it's made up of code snippets that, once inserted into the markup of a web document, allow us to use some Facebook's gadgets and widgets.

For example, the following code adds a "Like" button to our pages:

<fb:like href="http://www.site.com/"></fb:like>

Unfortunately, this code won't pass the W3C validation. Theoretically speaking, this problem would arise only with HTML, which is not extensible and its DTD is immutable. On the contrary, if we serve our documents as XHTML 1.1 and with a custom DTD, then we could use FBML without any problem.

I say "theoretically", because with XHTML 1.1 we must:

  1. serve our documents as application/xhtml+xml
  2. specify the FBML namespace in the root element (html)
  3. create a custom DTD

However, none of these steps can actually be done without a firm knowledge of how XML works, plus a long practice with parsing, DTDs, namespaces and XHTML 1.1. Is there a solution? Yes, and it involves injecting the above snippet directly into the DOM via JavaScript. For example, by using jQuery:

var $fbLike = '<fb:like href="http://www.site.com/"></fb:like>';
$($fbLike).appendTo('body');

But now a major accessibility problem arises: we have to deal with browsers that don't support JavaScript or have JavaScript turned off. Then we must provide the following fallback mechanism:

<noscript>
       <p><a href="http://www.facebook.com/plugins/like.php?href=http%253A%252F%252Fwww.site.com">Like</a></p>
</noscript>

By providing a simple textual link within a noscript tag we cater the accessibility needs of our users.

FBML (Facebook Markup Language) and the W3C

I just typed social markup language on Google and I got this. Excellent. So what's the point here? The point is, rather surprisingly, that the W3C is actually ignoring the social network phenomenon or, more explicitly, neglecting the actual needs of web users and developers. There's no SNML (Social Network Markup Language) standardized in any W3C specification. Too bad. So the W3C seems not to care very much about what is become a de facto standard of many web platforms. It seems to delegate to specific social network owners the task of creating a common set of tags to handle their documents. But this is exactly what happened a long time ago before the creation of the W3C itself, that is, the proliferation of proprietary and not-interoperable tags in the HTML. So what? The W3C should get more interested in the real web, now and not in a remote and distant future. The alternative is simply a jump back to the age of incompatible markup and the resulting chaos of platform wars.