views:

69

answers:

2
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.1.min.js"&gt;&lt;/script&gt;
    <script type="text/javascript">
        function isLoggedIn(){
        $('#fb_dash_anon').hide();
        $('#fb_dash_loggedin').show();
    }
    function isNotLoggedIn(){
         $('#fb_dash_loggedin').hide();
         $('#fb_dash_anon').show();
    }

    </script>


    <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US" type="text/javascript"></script>
    <script type="text/javascript">
    FB.init("1bdcdc1f61590a4b9f63b7dcf07a4e42", '/xd_receiver.htm', {"ifUserConnected" : isLoggedIn, "ifUserNotConnected" : isNotLoggedIn});
    </script>

    <div id="fb_dash_loggedin" style="display:none;">
    You are currently logged in. 
    </div>

    <div id="fb_dash_anon" style="display:none;">
    <fb:login-button onlogin="window.location = '/';">Connect</fb:login-button>
    </div>

It's very simple. I followed all the instructions that they have. In fact, this works on my other site. I just copied and pasted it to this new site and it's not working.

I have xd_receiver.htm, and it's there correctly. My site is: http://174.143.207.170:8000/

+1  A: 

Probably your App settings on facebook.com are not set up correctly. Check the settings and make sure it's pointing to your site url

1 facebook app can't point to multiple domains.

Infinity
Fixed, and you are right. I had to install the developer app on facebook and do URL authorization stuff. Tons of confusing stuff to set up on FB before this will work.
TIMEX
+1  A: 

It's been many months since I messed with FaceBook Connect, but I remember a couple "gotchas" that you may want to look into...

  • (1) IIRC, you have to register your app with FaceBook and get some sort of API key; FaceBook matches the host & domain of the incoming request with what it expects them to be based on the registration. If you're using the same API key for both sites, it probably won't work.

  • (2) There was something tricky I had to do to get it to work with localhost, and you may need to do something similar for a site based on an IP (not a registered domain name). I think I had to edit my HOSTS file to tell my laptop that it was the domain I registered with FaceBook, but perhaps I'm not remembering this part precisely.

Drew Wills