简体   繁体   English

Facebook的JavaScript SDK问题

[英]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? 我正在尝试使用facebook js sdk开发应用程序,但是我发现sdk有2个版本,我的问题是,新版本支持什么,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! 如果新版本仍然需要xdreceive.htm,则我已经阅读了文档,但仍然不理解这一点,请具有FB经验的人能为我提供帮助吗?谢谢您的帮助!

I am in the process of converting my facebook canvas app from the old version of the JavaScript SDK to the new version. 我正在将我的facebook canvas应用程序从旧版本的JavaScript SDK转换为新版本。 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. 首先,新SDK不需要xdreceive.htm。 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"). 初始化新SDK所需要做的就是来自Facebook文档的代码, 网址为http : //developers.facebook.com/docs/reference/javascript/您也可以将其与旧文档进行比较(我无法发表更多内容)个链接,因此只需将上述URL中的“ javascript”替换为“ 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. 两种SDK之间的主要区别之一是,新的SDK使用新的Graph API,而旧的SDK在Facebook的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. Facebook确实在推动开发人员使用新的Graph API,并且不会在旧的API中添加任何新功能。

Unfortunately, there are still a few things that you can do with the old SDK that has not been ported over yet. 不幸的是,您仍可以使用尚未移植的旧SDK进行一些操作。 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. 例如,有一个名为FB.CanvasClient.scrollTo(x,y)的方法,它允许您滚动到iframe中的某个位置,例如,可以在长页面后滚动回到顶部。 There is no equivalent method in the new SDK yet. 新的SDK中没有等效的方法。 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. 此外,对对话框使用新的SDK方法(发布到流等)将导致弹出对话框出现在iframe页面的中间,如果您的应用中有一些非常长的页面,则可能导致弹出窗口出现屏幕外,并且没有scrollTo方法,您的用户可能不会注意到它。

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. 基本上,新的SDK仍然存在一些错误,但是Facebook不会为旧的SDK添加新功能,并且很可能在某个时候完全停止支持并允许它。 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. 如果我提到的问题对于您的应用而言似乎不是一个大问题,那么我建议您使用新的SDK,因为我发现它更易于使用,并且避免了以后再编码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM