点赞按钮 - XFBML 或 Iframe

发布于 2024-12-23 06:34:52 字数 156 浏览 6 评论 0原文

我即将将 Like 按钮合并到我的网站中 - 这将是我第一次合并 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

丢了幸福的猪 2024-12-30 06:34:52

如果您希望网站中的代码快速且非侵入性,请使用 IFrame,但 SEO 可能会受到影响。

如果您想添加更多功能,请使用 XFBML 或 HTML5。但这是需要使用的,包括 JS SDK,但恕我直言,从长远来看它会更好

If you want it quick and non-intrusive code in your website use IFrame, but the SEO could be affected.

If you want to add more features use XFBML or HTML5. But that's required use ncluding the JS SDK, but IMHO it will be better in a long term

も星光 2024-12-30 06:34:52

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

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

请注意:我们弃用 FBML 不会影响 XFBML(扩展版
Facebook 标记语言)。 XFBML 是一组 XML 元素,可以
包含在您的 HTML 页面中以显示社交插件。当你的页面
加载后,在文档中找到的任何 XFBML 元素都将由
JavaScript SDK,导致呈现适当的插件
在您的页面上。 JavaScript SDK 将继续支持 XFBML
FBML 的弃用(除了 fb:serverFbml 元素,它是
用于在我们的服务器上执行 FBML)。

HTML5/XFBML/IFRAME?我认为这没有多大区别。一旦 facebook api 初始化,它们最终都会成为 iframe。如果您使用 firebug 或 chrome 检查元素,您可以看到这一点。也许不符合标准,xfbml 版本可能性能更好,因为通过标记名获取一堆元素比通过类名获取更快。

HTML5 版本需要注意的是,如果您计划订阅该插件的 events,初始化 api 时需要添加通道文件。如果没有它,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.

See https://developers.facebook.com/blog/post/568/

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? 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.

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).

忆梦 2024-12-30 06:34:52

FBML 将在未来 6 个月内消失,请参阅 https://developers.facebook.com/docs /reference/fbml/,因此这不是一个好的长期选择。 (FBML 和 XFBML 不一样。)XFBML 是一种有效的方法,但语法需要一些时间来适应。需要在网页上运行解析代码,这并不是什么大不了的事,但对某些网站所有者来说却很重要。

HTML5 是我这样做的方式,但需要在网页上运行解析代码,这并不是什么大不了的事,但对某些网站所有者来说却很重要。

iFrame 选项效果很好,但与任何其他方式一样,请务必检查 Facebook,看看他们是否会弃用它。

FBML is going away in the next 6 months, see https://developers.facebook.com/docs/reference/fbml/, so that won't be a good long-term option. (FBML and XFBML are not the same.) XFBML is a valid way to do it, but the syntax takes some getting used to. Requires running the parsing code on your webpage, not really a big deal, but it is to some web site owners.

HTML5 is the way I do it, but requires running the parsing code on your webpage, not really a big deal, but it is to some web site owners.

The iFrame option works great, but as with any other way, always be sure to check Facebook to see if they're going to deprecate it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文