Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Javascript SDK Problem: "FB is not defined"

The following code, copied from the Facebook documentation here, is not working for me in Chrome.

<div id="fb-root"></div> <script src="http://connect.facebook.net/en_US/all.js"></script> <script>   FB.init({   appId  : 'YOUR APP ID',   status : true, // check login status   cookie : true, // enable cookies to allow the server to access the session   xfbml  : true  // parse XFBML }); </script> 

In the Javascript console I get:

Uncaught ReferenceError: FB is not defined 

I'm not having any problems with the SDK in Firefox or Safari, just Chrome.

like image 215
Alex Miller Avatar asked Dec 29 '10 18:12

Alex Miller


People also ask

What is Facebook SDK for JavaScript?

The Facebook SDK for JavaScript provides a rich set of client-side functionality that: Enables you to use the Like Button and other Social Plugins on your site. Enables you to use Facebook Login to lower the barrier for people to sign up on your site. Makes it easy to call into Facebook's Graph API.

How do I use Facebook SDK in react?

Init the Facebook SDK in a React App Before Startup The below initFacebookSdk() function runs before the React app starts up to load and initialize the Facebook SDK, and automatically log the user into the React app if they are already logged in with Facebook. The init Facebook SDK function is called from the index.


1 Answers

I saw a case where Chrome had installed WidgetBlock which was blocking the Facebook script. The result was exactly this error message. Make sure you disable any extensions that may interfere.

like image 92
pbz Avatar answered Oct 05 '22 20:10

pbz