Facebook API not working well

Just tried to embbed a login button in html page with Facebook JavaScript API


<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/fr_FR/sdk.js#xfbml=1&appId=637150723035739&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-login-button" data-max-rows="1" data-size="medium" data-show-faces="false" data-auto-logout-link="false"></div>


I just get nothing as an output I don't know what i am doing wrong


Facebook/Google Login API's needs a specific App Domain from which your app should call the FB API functions. If not, it would simply not work as is in your case.

From Aknurm.com:

All you need is, a Facebook account and WAMP server running on your PC. Steps are quite simple.

Enable curl extension

By default on WAMP curl is disabled. In order to communicate with Facebook server you need to enable it. All you have to do is, Start your WAMP server then (left) click on green WAMP icon from system tray, navigate to PHP then PHP extensions and then check php_curl. You might need to restart your WAMP server to take effect.

Create a folder for your app on your PC. = Once you are done with enabling curls, you need to create a folder on your PC for your Facebook app. You can choose any name for it. In simple, create a new folder named fb inside your www folder of WAMP server. Then test it by navigating http://localhost/fb . You must see all your app content here.

Create app on Facebook

Once you are done with above two steps, you are now ready to create an app on Facebook. Just navigate to Facebook developer’s website and then from apps menu select Create New App.

Then Facebook will ask you for basic information about your app. You can choose any desired name and email address but you have to fill localhost as App Domain and http://localhost/fb as Website with Facebook login. This will enable login from localhost.

The Problem seems to be, that you have this code in a html-file on your local machine (e.g. Desktop) then it does not work. I tried it.

You have to run this html on Web-Server eg. XAMPP for testing purposes.

Here is a Link to XAMPP: https://www.apachefriends.org/de/index.html

Notice: if you new to web-design, a lot of code does not work without a server, direct run files works only with plain HTML, most of all other code (JS,PHP,...) only works with a server.

Need Your Help

Knockout 3.2 - 'if' based transition between AMD loaded components

javascript jquery knockout.js knockout-components

I have an SPA that uses knockout components dynamically loaded with require.

Can the C preprocessor be used to tell if a file exists?

c++ c include preprocessor c-preprocessor

I have a very large codebase (read: thousands of modules) that has code shared across numerous projects that all run on different operating systems with different c++ compilers. Needless to say,

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.