Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook SDK doesn't load...all.js GET failing

I'm using the same code provided in the here

<div id="fb-root"></div>
<script>
    window.fbAsyncInit = function() {
    console.log('got here');
    FB.init({
    appId      : '197112467099018', // App ID
    channelUrl : '//WWW.MYDOMAIN.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
   });

   // Additional initialization code here

   };

   // Load the SDK Asynchronously
   (function(d){
    var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
    if (d.getElementById(id)) {return;}
    js = d.createElement('script'); js.id = id; js.async = true;
    js.src = "//connect.facebook.net/en_US/all.js";
    ref.parentNode.insertBefore(js, ref);
   }(document));
 </script>

Chrome's console is telling me the script failed to load (GET failed) with 2 errors which are labeled (anonymous function)

The lines it points to as the errors are:

   ref.parentNode.insertBefore(js, ref);
   }(document));

Can anyone help me figure out whats wrong with these lines?

like image 660
zakdances Avatar asked Mar 23 '12 22:03

zakdances


2 Answers

I was using ghostery in chrome and didn't notice it blocked 'facebook connect'. I bet you have a similiar problem. Just happened to me.

like image 135
chmielot Avatar answered Oct 21 '22 23:10

chmielot


  1. Make sure you're running this code in the context of a web server (your browser URL starts with http: or https: protocol), and not from a local file (should not start with file:).

  2. Make sure you put that snippet in the <body> and not <head>.

like image 28
Eugene Avatar answered Oct 22 '22 00:10

Eugene