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 9128729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:34:59+00:00 2026-06-17T07:34:59+00:00

In my masterpage I have this code: <body> <div id=fb-root> </div> <script> window.fbAsyncInit =

  • 0

In my masterpage I have this code:

<body>
<div id="fb-root">
</div>
<script>
    window.fbAsyncInit = function () {
        FB.init({
            appId: "xxx",
            channelUrl: "/xd_receiver.htm",
            xfbml: false
        });
    };
</script>
....
</body>

and in a separate .js file i have my facebook code like this:

var Facebook = function () {
    var pub = {};
    var priv = {};

    pub.Login = function () {
        return priv.FacebookLogin();
    };

    priv.FacebookLogin = function () {
        FB.login(function (response) {
            if (response.authResponse) {
                FB.api('/me', function (response) {
                    console.log("you are logged in");
                    return response;
                });
            }
        });
    };

    return pub;
};

Now my issue is that using the code like this, calling Login which calls FacebookLogin function will return the console msg that login is called before init even though init is right where fb says it should be, just after the tag.
I tested to put my init clal just above my FB.login and then it worked again so something is wrong with the placemet. Previously I had the js file (that contains the facebook functions) linked in within the tags but I did try to put it right after the init script as well but I got the same fault. (the calling of the facebook functions are in a js file which is linked in , does that matter?)

Any ideas why im getting this error message, FB.login() called before FB.init()?

  • 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-17T07:35:00+00:00Added an answer on June 17, 2026 at 7:35 am

    The problem appeared to be the actual testing, when testing in localhost I had to rebuild the project which allowed me to use the login but if I just updated the page using F5 then i got the issue. Not 100% sure why but I worked around it by running after making changes.

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

Sidebar

Related Questions

I have a master page in C#, where I have this code: <div style=width:
I have this javascript: <script type=text/javascript> $(document).ready(function () { $('#social-share').dcSocialShare({ buttons: 'twitter,facebook,linkedin,digg,stumbleupon,delicious,pinterest,buffer,print,email', offsetLocation: 0,
I have this code in my Master page. PopUpWindow = function (titles, message) {
I have this code, I added JS Script file to my Master page. <script
I have 2 master pages that are nested.this is main master page code for
I have a Masterpage and I want to bind a part of this master
Up to this point we have not yet needed a new masterpage for our
In my masterpage, I have the following in the header. This allows me to
I have a page with a MasterPage, in the master page, I have this:
I have masterpage which has runat=server & Id set on body tag. see below

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.