2011-11-23 101 views
0

我想在我的網站上第一次使用Facebook連接。facebook在我的網站連接

我創建了一個應用程序,我從這裏複製的代碼,爲的是一個空白的HTML文件 http://developers.facebook.com/docs/guides/web/#login

,但我看到的是一個純文本 - 「與Facebook登錄」 - 沒有任何按鍵,沒有功能。

可能是什麼問題?

的代碼 -

<html> 
    <head> 
     <title>My Facebook Login Page</title> 
    </head> 
    <body> 
     <div id="fb-root"></div> 
     <script> 
     window.fbAsyncInit = function() { 
      FB.init({ 
      appId  : 'XXXXXXX', 
      status  : true, 
      cookie  : true, 
      xfbml  : 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> 
+0

對此問題的任何更新? – jean27

+0

我放棄了,用另一種方式做了。謝謝大家 – TamarG

回答

0

嘗試添加XML命名空間到您的文檔的<HTML>標籤。

<html xmlns:fb="http://ogp.me/ns/fb#"> 

...然後嘗試爲您的登錄按鈕如下:

<fb:login-button></fb:login-button> 
0

從我從你的HTML代碼注意到,你沒有鏈接到Facebook的JS SDK的標籤。然後

<script src="https://connect.facebook.net/en_US/all.js#appId={YOUR_FACEBOOK_APP_ID}&xfbml=1"></script> 

而不是做

<div class="fb-login-button">Login with Facebook</div> 

<fb:login-button></fb:login-button> 

就像什麼查理P.回答:

添加此。

-1

試着在主機上運行你的應用程序。如果你的項目是基於php的項目,意味着運行在https://localhost/projectname

而且還檢查您的Facebook應用程序設置。您的項目名稱應與網站名稱相同。

相關問題