JavaScript

JavaScript SDK: FB.XFBML.parse()

Updated: Apr 16, 2026
This function parses and renders XFBML markup in a document on the fly. This could be used if you send XFBML from your server via ajax and want to render it client side. XFBML enables you to incorporate FBML into your websites and IFrame applications.
You can use this function to re-render social plugins using either the XFBML syntax (e.g. <fb:like>) or the HTML5 syntax (e.g. <div class="fb-like">)

Examples

To re-parse all of the XFBML on a page, you can call:
FB.XFBML.parse();
Alternately, to only evaluate a portion of a document, you can pass in a single element.
FB.XFBML.parse(document.getElementById('foo'));

Parameters

Name Type Required Description
dom
DOMElement
no
root DOM node, defaults to body
cb
Function
no
invoked when elements are rendered