Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8606743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:10:14+00:00 2026-06-12T03:10:14+00:00

I stumbled upon an issue when trying to compile my application which is using

  • 0

I stumbled upon an issue when trying to compile my application which is using Facebook Javascript SDK :

[ERROR] ReferenceError: Can't find variable: FB

This is my setup :

index.html

...


<script id="microloader" type="text/javascript" src="sdk/microloader/development.js"></script>

  <!-- dependencies -->
  <script>
    window.fbAsyncInit = function() {
      FB.init({
        appId      : 'XXXXXXXXXXXXX', // App ID
        channelUrl : '//payme.com:3000/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>
...

Home.js (where the error is caught)

...
  config: {
    controls: {
      mainView: {
        initialize: 'initView'
      }
    }
  },

  initView: function() {
    var me = this;

    FB.getLoginStatus(function(response) {
      if(response.status === 'connected') {       
        ...
      } else {
        ...
      }
    });
  },
...

I tried to load Facebook SDK asynchronously and synchronously, place the script tag after and before the microloader but nothing works.

Any idea on how to fix this ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:10:15+00:00Added an answer on June 12, 2026 at 3:10 am

    You are loading the Facebook JavaScript SDK asynchronously and probably calling the method FB.getLoginStatus before the SDK is loaded. Call the method FB.getLoginStatus after the SDK is loaded (i.e. on the line where you have // Additional initialization code here )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get familiar with javaScript and currently stumbled upon one issue:
I'm pretty new in iphone programming and have stumbled upon this issue which I
I've stumbled upon this issue and my noob brain got fried trying to resolve
I just stumbled upon this issue and i can't think of a solution I
I stumbled upon this issue: myObject 's class has a public field MyField which
I've stumbled upon an issue and can't figure it out on my own. Hope
I have stumbled upon an issue I can't figure out right now. I get
So I'm trying to install a web application and I stumbled upon this question:
I stumbled upon an interesting error that I've never seen before, and can't explain
I got stumbled upon this issue once and I guess I need some expertise

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.