0 Replies - 7311 Views - Last Post: 15 May 2011 - 11:01 AM

#1 interivo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 15-May 11

Facebook Login Button not working with JavaScript

Posted 15 May 2011 - 11:01 AM

I'm trying to integrate a Facebook login into my site. If the user is already logged in, for now it should just say "Yes". If the user is not loggeed in, a Login with Facebook button should appear.

<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
            appId:'THIS IS SECRET', cookie:true, 
            status:true, xfbml:true 
FB.getLoginStatus(function(response) {
  if (response.session) {
  else {
    document.getElementById("head").innerHTML="<fb:login-button>Login with Facebook</fb:login-button>";

<div id="head">


If the user is logged in, the "Yes" comes up fine. But if not, only a plain text "Login with Facebook" comes up, not the button.

If I put the

<fb:login-button>Login with Facebook</fb:login-button>

directly within the "head" div, it works just fine. So why does it not work with the Javascript?

Is This A Good Question/Topic? 0
  • +

Page 1 of 1