How to Create a Facebook Application

Adding a New Application for the Facebook Social Network

© Mark Alexander Bain

Jan 16, 2009
Create a Facebook Application, Facebook
Facebook applications are an effective method of reaching millions of users and a programmer can build an new application in just a matter of minutes.

According to Facebook's press room statistics there are now over 150 million Facebook users. It is, therefore, not very surprising to learn that there are also 140 new applications added to Facebook every day. In fact anyone that has a Facebook account and access to a web server can create a Facebook application - and they won't even have to do that much programming. However, the first step is nothing to do anything with Facebook at all.

Facebook applications are not stored on the Facebook web server, they are actually stored on the application developer's own web server. Therefore the first step for any Facebook developer is to obtain some space on a web server, and once they've done that then they can consider creating a Facebook application.

Creating a Facebook Application on a Web Server

A Facebook application need not be complicated, for example a simple Javascript web page will suffice:

<input id=ip_far value=32>F
<input id=to_cen value=">>" type=button>
<input id=to_far value="<<" type=button>
<input id=ip_cen value=0>C
<script type=text/javascript>
document.getElementById('to_cen').onclick = to_cen_click;
document.getElementById('to_far').onclick = to_far_click;
function to_cen_click () {
var ip_far = document.getElementById('ip_far');
var ip_cen = document.getElementById('ip_cen');
ip_cen.value = 5 / 9 * (ip_far.value - 32);
}
function to_far_click () {
var ip_far = document.getElementById('ip_far');
var ip_cen = document.getElementById('ip_cen');
ip_far.value = 9 / 5 * ip_cen.value + 32;
}
</script>

This code, which will convert temperatures in Fahrenheit to Celcius or Celcius to Fahrenheit, can be saved as a web page and once the application developer has thoroughly tested it then they are ready to move on to Facebook itself.

Adding an Application to Facebook

The programmer's first step in adding their own application to Facebook is to add the Facebook Developer application to their own account. This can be done at http://www.facebook.com/developers/. Once it's there the developer will be able to access it in the 'Applications' section of their home page. If the developer opens the Developer application then they will see the 'Set Up New Application' button. This is, of course, used to add their own application.

Developer will need to supply a name for their new application and they will then be presented with the application edit screen. This is where they must add information about their application. It looks confusing. but are are actually very few fields that are essential. These are:

  • Basic
    • Application Name
    • Callback URLThis is the URL for the application on the developer's web server (for example http://www.linuxtalk.co.uk/f8/f8_demo.html)
  • Authentication
    • Who can use your application?This should be set to both 'Users' and 'Facebook pages'
  • Canvas
    • Canvas Page URLThis needs to single word consisting only of letters and underscores
    • Render MethodThe render method should be set to IFrame

All other items may be left with their default values. The application is now ready for use and can be added to a user's home page by going to the application's canvas page URL (for example http://apps.facebook.com/suite_demo/).

Summary

The addition of a new Facebook application is done in two stages and in two locations:

  • on the developer's web server
    • create and test the application
  • in Facebook
    • add the Facebook Developer application
    • set the new application's:
      • name
      • callback URL
      • who can use your application
      • canvas page URL
      • render method

Once that is done then the application can be added to any Facebook user's home page via the application's canvas page URL.


The copyright of the article How to Create a Facebook Application in Javascript/Java Programming is owned by Mark Alexander Bain. Permission to republish How to Create a Facebook Application in print or online must be granted by the author in writing.


Create a Facebook Application, Facebook
A Temperature Conversion Application for Facebook, Mark Alexander Bain
     


Post this Article to facebook Add this Article to del.icio.us! Digg this Article furl this Article Add this Article to Reddit Add this Article to Technorati Add this Article to Newsvine Add this Article to Windows Live Add this Article to Yahoo Add this Article to StumbleUpon Add this Article to BlinkLists Add this Article to Spurl Add this Article to Google Add this Article to Ask Add this Article to Squidoo

Post Your Comment
NOTE: Because you are not a Suite101 member, your comment will be moderated before it is viewable.
What is 7+10? Incorrect, please resolve x + y!