------ 文章開始 ------

<html>

<head>
</head>

<body>
<div id="fb-root"></div>
<script>
  // Additional JS functions here
  window.fbAsyncInit = function() {
    FB.init({
      appId      : '正確的app id', // App ID
      channelUrl : '//存放於任何電腦可以存取得到的空間/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 init code here
    FB.getLoginStatus(function(response) {
   if (response.status === 'connected') {
     // connected
   } else if (response.status === 'not_authorized') {
     // not_authorized
     login();
   } else {
     // not_logged_in
     login();
   }
  });
  };
  
    // 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/zh_TW/all.js";
     js.type = "text/javascript";
     ref.parentNode.insertBefore(js, ref);
   }(document));

function login(){
FB.login(function(response){
if( response.authResponse){
//connected
testApi();
}
else{
//cancelled
}
});
}

function testApi(){
console.log('Welcome! Fetching your information...');
FB.api('/me', function(response){
console.log('Good to see you, ' + response.name + '.');
});
}
</script>
</body>

</html>
------ 文章結尾 ------

[複製網址] [開新視窗] [檢舉短網址] [QR條碼]

服務條款 - 加入會員(免費) - 回報問題網址 - 聯絡偶們 -

© 2026 PPT.cc