1

I have included the code i needed to be able to show the facebook login button on my page. But the button does not show up, could you please read my code and tell me if you see any problems with it? Thank you

<!DOCTYPE html>
<html>
<body>

<script>
  window.fbAsyncInit = function() {
    FB.init({
      vappId            : '486506335043368',
      autoLogAppEvents : true,
      xfbml            : true,
      version          : 'v2.10'
    });
    FB.AppEvents.logPageView();
  };

  (function(d, s, id){
     var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(s); js.id = id;
     js.src = "//connect.facebook.net/en_US/sdk.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));
</script>

 <div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src =                             "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.10&appId=486506335043368";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-login-button" data-max-rows="1" data-size="large" data-    button-type="continue_with" data-show-faces="false" data-auto-logout-    link="false" data-use-continue-as="false"></div>


</body>
</html>
  • Do you get any errors? – Kenneth Larsen Aug 24 '17 at 13:25
  • Check the browser console. And are you testing this in a page you call via HTTP/HTTPS in your browser - or something else? – CBroe Aug 24 '17 at 13:31
  • Possible duplicate of ["Failed to load resource" using Facebook's example code](https://stackoverflow.com/questions/15669167/failed-to-load-resource-using-facebooks-example-code) – ViktorG Aug 24 '17 at 15:57

1 Answers1

1

I think there are 2 possible problems:

1)You need to change js.src assignment to: js.src="https://connect.facebook.net/en_US/all.js";

2)I think Facebook does not support calls from a local file, the script has to be run on a file with an http:// or https:// URI.

See this answer.

ViktorG
  • 505
  • 1
  • 7
  • 30