What are the differences between the Old and the New JavaScript SDK





Appreciate if you can like this page if you find it useful! - Click "Like"

First of all, I presume you know what I mean by the Old and the New JavaScript SDK. If not, then please kindly refer to the article "Which SDK I am using? the Old or the New?".

Of course, both of them can be used to access the data stored in Facebook but still they differ.

Well, I am not going to do a very detail comparison between them but below is what I would like share with you:

  • The Old JavaScript SDK cannot access Facebook's social Graph via the Graph API. On the other hand, we can access the FB's social graph by via the Graph API (by using the FB.api method in the new JS SDK).

    Well, by "via the Graph API" does not mean we are calling the Graph API directly. Instead, we are passing the "Graph API" request parameter to the FB.api method. This also applied to the New PHP SDK. As a result, we can develop on the same graph API no matter we are using the new JavaScript SDK or the new PHP SDK. And this would apply to other SDKs using the Graph API too.

    Having said that, we can see call the Old REST API via the new JavaScript SDK. This is done by calling FB.api with a different function signature. For details, please refer to the official document here.

    At this moment, we may not see too much benefits this, especially there are cases where we cannot get what we want via the Graph API as direct as what we have been doing via the Old REST API. However, do know what will happen in the future? There may be new features that can be accessed only via the Graph API.

  • The Old JavaScript SDK uses a cross-domain communications library to establish communication between third-party Web pages and Facebook pages and services inside a browser. As a result, you need to create a channel file called xd_receiver.htm in put it in your web server.

    For the New JavaScript SDK, this channel file is no longer required.

  • The Old JavaScript SDK is a "thick" API while the New JavaScript SDK is a "thin" one.

    I use the terms "thick" to describe the facts that the old JavaScript SDK are exposing a lot of functions to us. I believe these functions are basically like FB.ApiClient.friends_get, FB.Connect.streamPublish, FB.ApiClient.events_get etc with each of them doing a specific task.

    For the New JavaScript SDK, the number of functions exposed are greatly reduced. Many of the task-specific functions are now to be invoked via the single FB.api. We simply specify the "task" to be performed by changing the values of the parameter.

    One side effect of this is that the file size of the SDK is greatly reduced. We can even load the library on a module basis (but in most cases, we simply include all the modules, and this explains why we are loading a file called "all.js").

  • The New JavaScript SDK performs faster (as according to the doc in


Anyway, migrating to use the JavaScript SDK (if you are using the Old JavaScript SDK) is what Facebook recommends...



Find my FAQ on Facebook Development useful? Download the PDF for all the FAQs HERE!