facebook 应用程序问题:使用哪种文档类型以及我应该使用 XFBML 还是 iframe?

发布于 2024-11-25 16:59:50 字数 517 浏览 5 评论 0原文

我们正在寻求构建一个 Facebook 应用程序。我们的计划是在 HTML 5 网站上构建它,但据我所知,如果我们要在 HTML 5 上使用 XFBML 而不是 iframe,它将不兼容(因为 XFBML 几乎是一个 xml 命名空间)并且有firefox 中的一个小问题..我在那里看到了一个跨浏览器技巧,但它不会验证:

<!doctype html>
<html xmlns:fb="http://www.facebook.com/2008/fbml">

验证它的一种方法是将其作为“application/xhtml+xml”提供服务,但这当然行不通在 IE 中..

这是我第一次构建 Facebook 应用程序,我希望从其他有使用最新技术(例如 HTML5)开发 Facebook 应用程序的经验的开发人员那里得到任何建议/输入..我的另一个问题当然是,通常首选 XFBML 还是 iframe?

一如既往,我将不胜感激任何可以消除我的困惑的帮助/解释。如果问题不够清楚,请告诉我。谢谢。

we are looking to build a facebook application. Our plan is to build it on an HTML 5 site, but from what I have heard, if we are to use XFBML instead of iframe on HTML 5, it would not be compatible (since XFBML is pretty much an xml namespace) and there is a slight problem in firefox..There's a cross-browser trick I have seen out there, but it wont validate:

<!doctype html>
<html xmlns:fb="http://www.facebook.com/2008/fbml">

One way to validate it is to serve it as "application/xhtml+xml" but this of course wont work in IE..

This is my first time building an fb app, and I am hoping to get any suggestion/input from other developers who have had experience developing fb app using the most recent technology such as HTML5..My other question is of course, which one would generally be preferred, XFBML or iframe?

As always, I'd appreciate any help/explanation that would clear out my confusion. Let me know if the question is not clear enough. Thank you.

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

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

发布评论

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

评论(1

℉絮湮 2024-12-02 16:59:50

我不太确定 doctype, 可能没问题。如果有人知道更好请评论。现在的浏览器非常灵活,我认为您实际上不必担心太多。当您说“不会验证”时,您的意思是它不会在 W3C 验证器 中验证吗?如果这也是您所指的,请不要担心。没有人在乎,除了吹牛仪式之外,这没有什么区别(但同样,没有人在乎),更重要的是它能发挥作用。

XFBML 现在已经贬值了,所以我建议你走 iframe 路线。我已经开发了一些 Facebook 应用程序,其中一些使用 XFBML,一些使用 iframe,并且发现 iframe 方法的体验远没有那么令人沮丧。 XFBML 在你能做什么、不能做什么、支持哪些 API 等方面有各种各样的限制和限制。此外,Facebook 对外部加载的文件(如 JS 和 CSS)进行了一些严格的缓存,这使得开发有点像活生生的地狱。从字面上看,您可能会遇到这样的情况(或者无论如何在某一时刻都是这样):您必须重命名文件只是为了测试更改。

I'm not too sure about the doctype, <!doctype html> is probably fine. If some one knows better please comment. Browsers are pretty flexible these days, I don't think you actually have to worry too much. When you say "Won't validate" do you mean it wont validate in the W3C Validator? If that is what you are referring too don't worry about it. Nobody cares, it makes no difference other than bragging rites (but again, nobody cares) Its far more important that it just works.

XFBML has been depreciated now, so I would suggest you go the iframe route. I've done a few Facebook apps, some in XFBML and some in iframes, and have found the iframe approach to be a far less frustrating experience. XFBML has all kinds of restrictions and limitations in terms of what you can and can not do, which API's they support, etc. Also Facebook does some serious caching on externally loaded files like JS and CSS which makes development a little bit of a living hell. You can literally be (or it was like this at one point anyways) in a situation where you have to rename your files just to test changes.

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