access all features of the Graph API or dialogs via Javascript • Authentication • Rendering the XFBML versions of Social Plugins • Most functions in the FB Javascript SDK require an app id Wednesday, December 21, 11
must specify a <div> element with id “fb-root” in your web pages • The location of the script <div id=”fb-‐root”></div> http://connect.facebook.net/ /all.js en_US Wednesday, December 21, 11
must specify a <div> element with id “fb-root” in your web pages • The location of the script <div id=”fb-‐root”></div> http://connect.facebook.net/ /all.js zh_TW Wednesday, December 21, 11
the “fb-root” div element has been built FB.init({ appId : 'YOUR APP ID', status : true, // check login status cookie : true, // enable cookies xfbml : true // parse XFBML }); Wednesday, December 21, 11
call to the Graph API • depending on the connect status and the permissions function SuccessCall(res){ alert(res.name); } FB.api('/me', SuccessCall); Wednesday, December 21, 11
call to the Graph API • depending on the connect status and the permissions function SuccessCall(res){ alert(res.name); } FB.api('/me', SuccessCall); Call if success. Wednesday, December 21, 11
or popups with Facebook FB.ui( { method: 'feed', name: 'Facebook Dialogs', link: 'https://developers.facebook.com/docs/reference/dialogs/', picture: 'http://fbrell.com/f8.jpg', caption: 'Reference Documentation', description: 'Dialogs provide a simple, consistent interface for applications to interface with users.', message: 'Facebook Dialogs are easy!' } ); Wednesday, December 21, 11