Here's how you can do it:
FB.init( { "appId" : xxxxxxxxxx, "status" : true, "cookie" : true, "xfbml" : true, "oauth" : true }); FB.Event.subscribe('auth.authResponseChange', function(response) { // need to wait few seconds for fb login status to work in FireFox setTimeout('window.location.reload()', 3000); }); function fbConnect(){ FB.getLoginStatus(function(response) { if (response.authResponse){ FB.login(function(response) { if (response.authResponse) { } else { //console.log('User cancelled login or did not fully authorize.'); } }, {"scope":"email,manage_pages"}); } }); }
You need to call the fbConnect() function.
Also make sure you have the <body> on your page:
<div id="fb-root"></div> <script src="//connect.facebook.net/en_US/all.js"></script>
source share