在javascript上的facebook画布空白

时间:2015-02-17 08:00:54

标签: javascript facebook canvas

任何人都可以解决这个问题,因为为什么在我的Facebook画布应用程序中的这个代码加载空白页?当我用登录的Facebook帐户链接到https://awgame.8ternals.com/games时,似乎工作正常。这是代码:

 <script>


    window.fbAsyncInit = function() {
      FB.init({
        appId      : '609246715874390',
        xfbml      : true,
        version    : 'v2.2'
      });

      // ADD ADDITIONAL FACEBOOK CODE HERE
      FB.Canvas.setSize({ width: 640, height: 480 });
     var element = document.getElementById('allContent');
      FB.Canvas.showFlashElement(element);
      function onLogin(response) {
        if (response.status == 'connected') {
          FB.api('/me?fields=first_name', function(data) {
            var welcomeBlock = document.getElementById('fb-welcome');
            welcomeBlock.innerHTML = 'Hello, ' + data.first_name + '!';
          });
        }
      }

      FB.getLoginStatus(function(response) {
        // Check login status on load, and if the user is
        // already logged in, go directly to the welcome message.
        if (response.status == 'connected') {
          onLogin(response);
        } else {
          // Otherwise, show Login dialog first.
          FB.login(function(response) {
            onLogin(response);
          }, {scope: 'user_friends, email'});
        }
      });
    };

    (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/sdk.js";
       fjs.parentNode.insertBefore(js, fjs);
     }(document, 'script', 'facebook-jssdk'));

 </script>

任何帮助将非常感谢我展示我的Facebook画布应用程序

1 个答案:

答案 0 :(得分:0)

好的,问题就解决了。首先,我将文件从html更改为aspx。第二,在我的应用信息中心,我将链接https://awgame.8ternals.com/games/更改为https://awgame.8ternals.com/games/tes.aspx