-1
我想在我的網站上使用Facebook登錄,這裏是我如何加載SDKFacebook登錄JS SDK重定向
window.fbAsyncInit = function() {
FB.init({
appId : '362869753746986', // App ID
channelUrl : '//WWW.FESTIVEHUB.COM/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Additional initialization code here
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
和登錄按鈕
<div class="fb-login-button" data-show-faces="true" data-width="200" data-max-rows="2"></div>
如果我點擊登錄按鈕,它顯示一個新的Facebook登錄窗口,如果我這樣做登錄問題,但是登錄後,新的小窗口仍然是空白的,但如果我手動關閉它並刷新我的網頁登錄按鈕被替換爲我的FB個人資料照片我需要登錄窗口自動關閉,我需要一個回調函數我可以在登錄後採取行動。 NB正在本地主機上工作,如果值得注意的話!