Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use jQuery with Facebook apps?

I've been scouring various sites looking for info on how to do this but haven't found anything. Has anyone done this? Suggestions on where to look for info on how to use it?

like image 768
Abe Miessler Avatar asked Feb 07 '11 22:02

Abe Miessler


People also ask

Is jQuery used in Facebook?

facebook doesn't use jQuery (or any other framework) for a reason, that i am asking for. This is pretty subjective by nature.

Is it still OK to use jQuery?

“Most websites are not complex Web apps needing a sophisticated framework, [they are] mostly static sites with some dynamic behaviors — often written using WordPress. jQuery is still very popular there; it works and it's simple, so people don't feel the need to stop using it.”


2 Answers

There are a couple of types/purposes when creating a Facebook App, and I believe your question is about Apps on Facebook.com.

UPDATE: On March, 11, 2011 Facebook stopped allowing new FBML apps to be created. So back to your questions:

Can I use jQuery with Facebook apps?

YES, you can use any JS library in your Apps (Canvas, tab or website) since the iframe is the only canvas type now.


Now facebook still gives you the choice between developing your Facebook application canvas either in IFrame or FBML BUT they are encouraging developers to use IFrame as they are in the process of deprecating the FBML:

We are in the process of deprecating FBML. If you are building a new application on Facebook.com, please implement your application using HTML, JavaScript and CSS. You can use our JavaScript SDK and Social Plugins to embedded many of the same social features available in FBML. While there is still functionality that we have not ported over yet, we are no longer adding new features to FBML.

Also as you can notice on their Javascript-SDK, that one of the example is actually using the jQuery library!

SO, can I use jQuery with Facebook Apps?
YES, .... and NO!
YES: you can use it inside your Canvas Page if you choose IFrame AND
NO: you can't use it inside your Page Tabs, yet:

Broadly, a Page Tab is loaded in exactly the same way as a Canvas Page, with one (large) exception. Page Tabs still use our FBML infrastructure, rather than using an iframe in the browser. In order to correctly render FBML tags, our servers need to process the content at the Tab URL before it is sent to the user's browser. In practice, you can still use HTML, JavaScript (using FBJS) and CSS for your content, but there are a number of quirks.

We are in the process of moving our Page Tab infrastructure a pure iframe solution currently, but we do not expect to complete that work until Q1 2011. In the meantime, we recommend that developers to minimize the amount of FBML code they can add to their apps.

As you can see, we are IN the first quarter of 2011 so Page Tab IFrame support is around the corner!

EDIT:
IFrame support for Facebook Pages was added!!

like image 121
ifaour Avatar answered Oct 12 '22 01:10

ifaour


Yes. The preferred method for Facebook Canvas Apps is to use an iframe as the means for pulling in the app content. In this case, you are able to use jQuery within your application just as you normally would.

See http://developers.facebook.com/docs/guides/canvas for more info.

like image 37
Bobby Whitman Avatar answered Oct 12 '22 02:10

Bobby Whitman