Problem with Firefox 8 for Mac: window.name - undefined

I am trying to set up a new Facebook Javascript API on my website, but I had a problem with Firefox (works fine with Chrome and Safari, but for full validation on IE, but was not informed about the lack of issues).

The problem is indicated at the beginning of the all.js file on Facebook, the message says:

window.name is undefined if(!window.FB)window.FB={_apiKey:null,...return document.getElementById(a);}}; all.js (line 3) 

Therefore, any subsequent calls to the SDK using the FB. results in an error with a message

 FB is not defined [Break On This Error] FB.login(function(response) 

The code I used is

 <div id="fb-root"></div> <script> window.fbAsyncInit = function() { FB.init({ appId : 'my_app_id', // App ID channelURL : 'my_channel_file', // Channel File status : true, // check login status cookie : true, // enable cookies to allow the server to access the session oauth : true, // enable OAuth 2.0 xfbml : true // parse XFBML }); startLoad(); 

};

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

Any clues as to what the problem is? And has anyone encountered this error before?

+2
javascript facebook facebook-javascript-sdk
Jan 08 2018-12-12T00:
source share
1 answer

Solved: unbelievably, the only minor mistake was that I used a global variable inside my JS file called "name". This is a serious absence-not with the SDK for Facebook (although not mentioned anywhere). I found the arguments from a link that I don’t remember, but the main problem is that the global name variable is distorted using window.name, which is required by the FB api.

I just suggest avoiding a global variable called a name, regardless of whether you use the Facebook SDK. Just in case.

+3
Jan 09 2018-12-12T00:
source share



All Articles