HTML5 and Facebook's FBML


Syndication

This post was orignally posted on Tumblr on the blog: Nerd Ramblings. View the full syndicated blog or view the original post.


The Facebook Markup Langauge (FBML), works well with XHTML but fails when it comes to HTML5. Hopefully they’ll make this work with the final HTML5 standard.

On to the solution

<script src=“http://connect.facebook.net/en_US/all.js#xfbml=1”></script>
<script type=“text/javascript”>
document.write(’<fb:like layout=“button_count” show_faces=“true” width=“100”></fb:like>’)
</script>

Thats it. Wrap the <fb> tags in Javascript and add ‘document.write’. Comes out as completely valid HTML5.

Add it to your HTML5 site and validate it. 

Update: 

FBML has been deprecated. Starting June 1, 2012 FBML apps will no longer work as all FBML endpoints will be removed. If you are building a new application on Facebook.com, please implement your application using HTML, JavaScript and CSS. You can use our JavaScript SDK and Social Plugins to embedded many of the same social features available in FBML.

Facebook

FBML is now covered by a Javascript SDK and Social Plugins. Which are written for HTML5.