Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Apr 4, 2011

Facebook Graph API init problems

When we turn to the new Graph API for our facebook applications we were faced with the problem of actionscript API initialization on some web browsers like Internet Explorer and Opera. You can find actionscript Graph API here http://code.google.com/p/facebook-actionscript-api/

After detailed studying of source code of that library we discovered that the problem is in Facebook Javascript SDK events. It is due to actionscript library is actually based completely on javascript SDK.
If you'll look into "api\com\facebook\graph\core\FacebookJSBridge.as" file you'll see how FB.init() method implemented:

init: function( opts ) {
FB.init( FB.JSON.parse( opts ) );

FB.Event.subscribe( 'auth.sessionChange', function( response ) {
FBAS.updateSwfSession( response.session );
} );
}


Even if you use Javascript SDK you won't catch events you subscribed on.

Solution of this problem was found in Facebook app settings. 
You need to fill in both fields "Site URL" and "Site Domain" on "Web Site" tab in you app settings.

Very strange that this problem manifested itself only on the IE and Opera browsers.
Anyone knows why?