Optimize Facebook Social Plugin Performance

Today, Facebook has published an article in its Developer Blog, telling us a few tips on optimizing the social plugin performance.

In particular, the following issues are discussed:

  • the use of the custom channel URL
  • asynchronous loading of the JavaScript SDK

Well, the concept of using the custom channel URL has been documented in the Old JavaScript Client library (or sometimes refer as the FB-Connect Library) but is not mentioned before in the documentation of the JavaScript SDK. I believe this is because you need to have that specified in the old JavaScript client library so as to the FB-Connect works.  On the other hand, Facebook should have “enhanced” the JavaScript SDK so that custom channel URL is no longer a must.  (Well, Facebook has actually confirmed and explained this in the article.)

Probably Facebook is reviewing its code during the development of the new version of JavaScript SDK that supports OAuth 2.0.  (Do you still remember that Facebook has encountered problems in developing the new version and delayed its release?)  And I believe during the review, Facebook found that custom channel URL is required in some cases and therefore Facebook now “promotes” the use of the custom channel URL.

For the asynchronous loading of the JavaScript SDK, it has been documented since the release of the JavaScript SDK.  Personally, for most of the application that I developed, I load the JavaScript SDK synchronously.  The reason is that I have been encountering mysterious cases/problems in the past if the JavaScript SDK is loaded asynchronously. I am not sure if this is because of some bugs in the JavaScript SDK or not.  I just know that I am pretty sure everything will work perfectly if I load it synchronously.  What is your experience?

This entry was posted in Development Tips and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *