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开发者_JS百科 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.
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.
精彩评论