Friday, January 25, 2008

Facebook releases JavaScript Client Library

Wei Zhu seems to be cooking with gas recently, and has released the JavaScript Client Library for Facebook API, which is a client side JavaScript library that mimics the other language client libraries (PHP, Python, Java, Ruby, etc):

An application that uses this client library should be registered as an iframe type. This applies to either iframe Facebook apps that users access through the Facebook web site or apps that users access directly on the app’s own web sites.

The solution uses a cross domain receiver:



  2. <html xmlns="">

  3.     <title>cross domain receiver page</title>

  4. </head>

  5. <body style="background-color:Green;">

  6.     <script src="" type="text/javascript"></script>

  7.     <script type="text/javascript">

  8.         FB_ReceiverApp$main();

  9.     </script>

  10. </body>

  11. </html>


Then, with a few script src's you can talk to Facebook:



  2. // Create an ApiClient object, passing app’s api key and

  3. // a site relative url to xd_receiver.htm

  4. var api = new FB.ApiClient('<insert_your_app_key_here', '/xd_receiver.htm', null);


  6. // require user to login

  7. api.requireLogin(function(exception) {

  8.     window.alert(“Current user id is “ + api.get_session().uid);


  10.     // Get friends list 

  11.     api.friends_get(function(result, exception) {

  12.       Debug.dump(result, 'friendsResult from non-batch execution ')

  13.     });       

  14. });


It is good to see a JavaScript API like this. Now you can stay in JavaScript land and write code that works with OpenSocial, Facebook, and more. NOTE: If you live in FBML? No cigar.


Aubrey Dickey said...

The solution has received positive feedback for its design firm San Francisco functionality and user-friendliness. The team is receptive to feedback and easy to work with.

Salk Jons said...

The client praised Infinum for their quality developers and their ability to adhere to strict timelines.
top branding companies

Harry said...

Emphatic and detail-oriented, they agency app effectively aligned their designs with overall goals.

Margie Jones said...

The team’s response time is commendable, and its collaborative nature makes for an agreeable engagement.
top branding

Rodney Janis said...

Their approach combined business strategy and technical innovation.
top UX designer

Aubrey Dickey said...

Your blog is extremely brilliant especially the quality content is really appreciable.
custom logo design companies

Kimberly Beckham said...

I have checked this link this is really important for the people to get benefit from.
logo design business

Ivan Irwin said...

It's not my very first time to visit this blog; I’m visiting this daily and acquire superb info from here day by day.
professional web design company

Harry Jack said...

I truly appreciate your working guys, thumbs up!!
interactive design company

Post a Comment