1

I am loading the api like so:

<div id="fb-root"></div> 
<script> 
    window.fbAsyncInit = function() { 
        FB.init({ 
        appId      : 'YOUR_APP_ID', // App ID 
        channelURL : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File 
        status     : true, // check login status 
        cookie     : true, // enable cookies to allow the server to access the session 
        oauth      : true, // enable OAuth 2.0 
        xfbml      : true  // parse XFBML 
        }); 
    }; 

    (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/el_GR/all.js"; 
    d.getElementsByTagName('head')[0].appendChild(js); 
    }(document)); 
</script>

I am opening a page through a jQuery UI dialog and reparsing the #comments section with:

<script>FB.XFBML.parse(document.getElementById('comments'));</script>

While on the non-ajax loaded page works fine, when I am opening it from the dialog it gives the error (on the js console):

Permission denied to access property 'fb_xdm_frame_https' @ https://s-static.ak.fbcdn.net/rsrc.php/v1/yt/r/Via9RsGlPnX.js:66

and it looks as if it still is loading (the gif keeps playing) enter image description here

Any ideas?

4

1 回答 1

1

我认为您没有正确加载 javascript sdk。试试这个代码

window.fbAsyncInit = function() {
     FB.init({
          appId      : 'appid', // App ID
          channelUrl : 'http://www.url.com', // Channel File
          status     : true, // check login status
          cookie     : true, // enable cookies to allow the server to access the session
          xfbml      : true  // parse XFBML
     });
};

 (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/en_US/all.js";
      ref.parentNode.insertBefore(js, ref);
 }(document));
于 2012-05-18T05:48:54.473 回答