"<div id='fb-root'></div>
<script>
window.fbAsyncInit = function()
{
FB.init({
appId: 'ID',
status: true,
cookie: true,
xfbml: true
});
FB.getLoginStatus(function(response)
{
if(response.status === 'connected')
{
if (response.authResponse != 'undefined')
{
window.location = '/fb_redirect.php';
}
} else if(response.status === 'not_authorized')
{
} else
{
FB.Event.subscribe('auth.login', function(response)
{
window.location = '/fb_redirect.php';
});
}
});
};
(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/all.js#xfbml=1&appId=ID';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class='fb-login-button' data-show-faces='false' scope='email' registration-url='http://www.sportannica.com/fb_redirect.php' size='large' data-width='200' data-max-rows='1'></div>
這就是我現在使用的。對於已經接受該應用的用戶來說,它可以正常工作。但是,對於第一次使用的用戶,點擊登錄按鈕後,就不會彈出任何屏幕,並顯示有關應用程序的詳細信息,例如有多少人使用它或者請求的是哪種類型的權限。它只是前往/fb_redirect.php。FB登錄按鈕不提示第一次用戶的範圍
看到在知情同意指定網站的網址?是登錄到FB並接受應用程序後頁面被重定向到的URL嗎?
謝謝。但是,在fb_redirect文件中......會話已啓動,或者如果它是首次執行插入查詢的用戶。這些都需要在登錄按鈕所在的頁面上發生嗎? – Lance 2013-03-22 22:12:34
你能解釋一下自己嗎? – 2013-03-22 22:17:59
我現在連接到的互聯網不會讓我通過ftp連接到我的遠程服務器。所以,我無法上傳你的代碼,看看它是否有效。但是,從以前的經驗來看,window.location ='some_other_file.php'從來沒有用過。出於某種原因,儘管window.reload()似乎工作得很好。 – Lance 2013-03-22 22:22:30