ApkAppsBusinessDigital MarketingSocial MediaTechnology

Facebook Platform Core Components

Along with its rich API, Facebook provides several components that allow application developers to easily replicate the look and feel of Facebook within their application and get access to all the data in the social graph. These components are based on existing well-known web development languages like HTML, JavaScript, and SQL to make it easier for developers to be productive quickly.

FBML

As previously mentioned, FBML is an acronym for Facebook Markup Language. FBML is a tag-based language based on HTML. It provides many of the tags supported by that language and provides a large set of Facebook user interface and programmatic primitives. FBML is automatically parsed and translated into HTML, Cascading Style Sheets (CSS), and JavaScript code by Facebook servers when a request for an application page that contains it is detected.

FBML gives developers access to controls that allow applications to look like they were developed as part of Facebook. When an application is created, the developer must choose whether that application will support FBML. It is always suggested that developers new to Facebook applications use FBML unless they have a specific need for a technology that does not allow it. For example, if your application uses third-party JavaScript libraries that are over 64K in size, you cannot use FBML; you must use an Iframe-based application instead.

FBJS

FBJS is Facebook’s version of JavaScript. It supports most of the DOM-based manipulation methods that developers are comfortable with and the familiar events, functions, anonymous closures, and properties. It differs from JavaScript in several important ways. First, its syntax is slightly different, primarily to protect Facebook itself from malicious JavaScript code. Next, many DOM properties used in normal JavaScript are replaced by get/set property methods.

Finally, some widely-used event handlers are not available that are widely used in normal client-side JavaScript. For example, Facebook does not allow use of the ubiquitous on load event handler to execute code when a web page loads. In all but a few locations, a user must take a physical action on the page (set focus to a control, click a mouse button, hit a key) before FBJS can execute.

To further protect itself, Facebook wraps all FBJS in what’s called the sandbox. To accomplish this, Facebook prepends all FBJS variables, function names, and function parameters with a special string that ensures that no FBJS code conflicts with or can override any existing JavaScript code that might be on the page.

Related Articles

Leave a Reply

Back to top button