Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load javascript facebook api SYNCHRONOUSLY ...?

I want to load facebook api ( javascript SDK) synchronously. I have seen this code on facebook developers.

<div id="fb-root"></div>
<script src="//connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId      : 'YOUR_APP_ID',
channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
status     : true, // check login status
cookie     : true, // enable cookies to allow the server to access the session
xfbml      : true  // parse XFBML
});
</script>

and also on reference to another link http://www.masteringapi.com/tutorials/facebook-javascript-sdk-best-practices/58/ is is mentioned that "But you need to make sure you don’t define FB in your own JS code or libraries!"...............

I am confused ....! Please help me....

like image 572
Manoj Hipparagi Avatar asked Feb 07 '12 07:02

Manoj Hipparagi


1 Answers

What you are doing looks fine.

The instruction that you've seen, "But you need to make sure you don’t define FB in your own JS code or libraries!" is simply a warning to not declare a variable named FB in your application, or you will hide the Facebook SDK.

In your code, on the very next line, you could begin making calls with FB.api or any of the other methods.

Does that help?

like image 154
Matt H. Avatar answered Oct 13 '22 10:10

Matt H.