点赞按钮-XFBML或iframe [英] Like button - XFBML or Iframe

查看:95
本文介绍了点赞按钮-XFBML或iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将在我的网站中添加喜欢"按钮-这是我第一次将Facebook功能纳入其中-并希望获得有关使用XFBML选项还是Iframe选项的一些指导. XFBML似乎为将来提供了更多的灵活性,但是a)这种方法是否有任何缺点,并且b)兼容HTML5的版本是否更好?谢谢.

I'm about to incorporate Like buttons into my web site - it'll be the first time I've incorporated Facebook fubctionality - and would like some guidance on whether to use the XFBML option or the Iframe option. It seems as though XFBML offers more flexibilty for the future, but a) are there any disadvantages to this approach, and b) is the HTML5 compliant version better still? Thanks.

推荐答案

XFBML不会消失,并且与FBML不同.我对此也感到困惑,因为他们的所有社交插件示例代码仍然为您提供了xfbml选项.

XFBML is not going away and is different than FBML. I too was confused about this since all of their social-plugin example code still gives you the xfbml option.

请参见 https://developers.facebook.com/blog/post/568/

请注意:我们对FBML的弃用不会影响XFBML(扩展 Facebook标记语言). XFBML是一组XML元素,可以 HTML页面中包含的内容,以显示社交插件.当你的页面 加载后,文档中找到的所有XFBML元素都将由 JavaScript SDK,从而呈现相应的插件 在您的页面上.之后,JavaScript SDK将继续支持XFBML 弃用FBML(保存为fb:serverFbml元素,即 用于在我们的服务器上执行FBML.

Please Note: Our deprecation of FBML does not impact XFBML (eXtended Facebook Markup Language). XFBML is a set of XML elements that can be included in your HTML pages to display Social Plugins. When your page is loaded, any XFBML elements found in the document are processed by the JavaScript SDK, resulting in the appropriate plugin being rendered on your page. The JavaScript SDK will continue to support XFBML after the deprecation of FBML (save for the fb:serverFbml element which is used to execute FBML on our servers).

HTML5/XFBML/IFRAME?我认为这没什么大不了的.初始化Facebook API后,所有这些都将最终成为iframe.如果您使用Firebug或chrome检查元素,则可以看到此内容.也许不符合标准,xfbml版本可能更符合要求,因为通过标记名获取一堆元素要比通过类名更快.

HTML5 / XFBML / IFRAME? I don't think it makes much difference. Once the facebook api is initialized all of them end up as iframes. You can see this if you inspect the element with firebug or chrome. Maybe not as standards-compliant, the xfbml version is probably more peformant since getting a bunch of elements by tagname is faster than by classname.

关于HTML5版本的警告是,如果您打算订阅该插件的

Once caveat with the HTML5 version is that if you plan to subscribe to the plugin's events, you'll need to add a channel file when you initialize the api. The xfbml versions work fine without it (at least as of this writing).

这篇关于点赞按钮-XFBML或iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆