0
我正在檢查用戶是否註冊了我的應用程序,如果不是,我試圖顯示一個Facebook註冊按鈕,但它沒有顯示出來。Facebook註冊沒有顯示
下面是javascript代碼,我在我的網頁頁腳:
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : '281914178557709',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
}
else if (response.status === 'not_authorized') {
alert("Show registration");
$('#fb_register').html('<label class="control-label" for="fname"> </label><div class="controls"><fb:login-button registration-url="/register_facebook.php" /></div>');
}
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
我div標籤很簡單:
<div class="control-group" id="fb_register"></div>
我看到我的警告消息,以便我知道我擊中了正確的區域,但按鈕無法渲染。如果我使用直接文本渲染。任何想法爲什麼XFBML沒有被渲染?
這隻有在他們已經登錄到他們的Facebook賬戶中才有效? – Paul 2012-04-09 13:58:46
這是正確的。 – trickyzter 2012-04-09 14:22:53