Facebook JavaScript SDK加载问题

时间:2013-08-23 17:36:47

标签: javascript android cordova facebook-javascript-sdk

我从facebook API网站复制/粘贴代码(稍作调整),但未加载。这是代码:

 <div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    // init the FB JS SDK
    FB.init({
      appId      : 'xxx',                        // App ID from the app dashboard
      channelUrl : 'channel.html', // Channel file for x-domain comms
      status     : true,                                 // Check Facebook Login status
      xfbml      : true                                  // Look for social plugins on the page
    });

    // Additional initialization code such as adding Event Listeners goes here
    alert('inited');
  };

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

我正在尝试在Android PhoneGap应用上使用它,但它也无法在我的浏览器上运行。 为什么会这样?

0 个答案:

没有答案