facebook javascript sdk question
I'm trying to use the facebook js sdk to develop an app, but I found the there is 2 version of the sdk, my question, is what is support with the new and what w=not? and if the xdreceive.htm is still needed for the new version, I have read the docs and still can't understand this, can someone with experience in FB can 开发者_运维知识库me kind and asnwer me this, thanks for any help!
I am in the process of converting my facebook canvas app from the old version of the JavaScript SDK to the new version. I may not have run across all the functionality differences yet, but I'll tell you the ones I have noticed.
First off, xdreceive.htm is not required for the new SDK. All that is required to initialize the new SDK is the code from the Facebook documentation here: http://developers.facebook.com/docs/reference/javascript/ You can also compare this with the old documentation (I can't post more than one link, so just replace "javascript" in the above URL with "oldjavascript").
One of the main differences between the two SDK's is that the new one uses the new Graph API, while the old one is running on Facebook's Old Rest API. Facebook is really pushing developers to use the new Graph API and no new features will be added to the old API.
Unfortunately, there are still a few things that you can do with the old SDK that has not been ported over yet. For instance, there was a method called FB.CanvasClient.scrollTo(x, y) that allowed you to scroll to a spot in the iframe, so that for instance, you could scroll back to the top after a long page. There is no equivalent method in the new SDK yet. Also, using the new SDK's method for Dialogs (to publish to stream, etc.) will result in the popup dialog appearing in the middle of the iframe page, which if you have some really long pages in your app can cause the popup to appear off screen, and with no scrollTo method, your users may not notice it.
Basically, there are still a few bugs with the new SDK but Facebook will not be adding new features for the old one and most likely will completely stop supporting and allowing it at some point. If the issues I mentioned don't seem like a big problem for your app I would recommend using the new SDK as I find it easier to use and to avoid having to recode later.
精彩评论