WordPress.org

Ready to get started?Download WordPress

Forums

Simple Facebook Connect
[resolved] Embedding XFBML and FB's javascripts in the document. (5 posts)

  1. apurvasukant
    Member
    Posted 1 year ago #

    In context of wordpress performance, W3-Edge talks of embedding XFBML in the document thus:

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"
    xmlns:x2="http://www.w3.org/2002/06/xhtml2"
    xmlns:fb="http://www.facebook.com/2008/fbml">
    <head>

    Subsequently embedding FB's JS thus,

    <body>
    <div id="fb-embed"></div>
    <script>
    window.fbAsyncInit = function() { FB.init({appId: 'XXXXXXXXXXXXXXX', status: true, cookie: true, xfbml: true}); };
    (function() {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol +
    '//connect.facebook.net/en_US/all.js';
    document.getElementById('fb-embed').appendChild(e);
    }());
    </script>

    Lastly they suggest displaying the like box in this manner:

    <fb:like profile_id="XXXXXXXXXXXX" href="http://domain.com/" width="450"></fb:like>

    All this is in order to circumvent delays at FB's end in loading FB objects at the WP install.

    Though I am currently very happy with the performance of SFC on my WP install, I request your help regarding implementing this XFBML and JS embedding so I can gain a couple of seconds on page generation:) with my WP install, SFC and W3TC. Maybe you would consider it a future feature of your plugin too ( if it is not possible to do all this already, in which case please suggest.)

    Much thanks and great work!

    http://wordpress.org/extend/plugins/simple-facebook-connect/

  2. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 1 year ago #

    SFC already uses XFBML and asynchronous script loading, by default.

  3. apurvasukant
    Member
    Posted 1 year ago #

    Thanks for your prompt response. I asked about embedding because I didnt see xmlns:fb="http://www.facebook.com/2008/fbml" declaration in my <head> section\s output. Should I insert it manually by editing my header.php?

  4. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 1 year ago #

    Make sure your theme has this in the header.php so that the proper information can be added to the HTML tag:

    <html <?php language_attributes(); ?>>

  5. apurvasukant
    Member
    Posted 1 year ago #

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic