<html>
<head>
<title>My Facebook Login Page</title>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'appID',
status : true,
cookie : true,
xfbml : true,
oauth : true,
});
};
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
<div class="fb-login-button">Login with Facebook</div>
</body>
</html>
Every time when i click on [Login with Facebook] button i see in JS Console
this message "FB.login() called when user is already connected."
How to disconnect user?
Use FB.getLoginStatus method to find whether the user in logged in or not.
If they already logged in, try to hide the Login button. Because the login button will be visible always and do nothing on click when the user already logged in.
Refer this link for FB.getLoginStatus