Best use of Facebook SDK + html5 vs xfbml

admin

Administrator
Staff member
I've implemented the JavaScript SDK in my website as stated on the facebook JavaScript SDK site.:

Code:
<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : 'YOUR_APP_ID', // App ID
      channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      xfbml      : true  // parse XFBML
    });

    // Additional initialization code here
  };

  // Load the SDK Asynchronously
  (function(d){
     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/en_US/all.js";
     ref.parentNode.insertBefore(js, ref);
   }(document));
</script>

But in the like plugin code section it gives me this code:

Code:
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=YOUR_APP_ID";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<strong>My 1st question: What is the better code? and are their any differences?</strong>

My second question is about the HTML5 or XFBML rendering of the buttons or comment boxes. I run a wordpress blog, that's not html5.

<strong>My 2nd question: What is the best code to use, the HTML5 or the XFBML? and is one faster that the other, or one less supported than the other?</strong>

Thanks!