我是这样加载api的:
<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>我正在通过一个jQuery UI对话框打开一个页面,并用以下内容对#comments部分进行重新分析:
<script>FB.XFBML.parse(document.getElementById('comments'));</script>虽然在非ajax加载的页面上工作正常,但当我从对话框打开它时,它会出现错误(在js控制台上):
Permission denied to access property 'fb_xdm_frame_https' @ https://s-static.ak.fbcdn.net/rsrc.php/v1/yt/r/Via9RsGlPnX.js:66它看起来好像还在加载( gif继续播放)。

有什么想法吗?
发布于 2012-05-18 05:48:54
我认为您没有正确地加载javascript。试试下面的代码
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));https://stackoverflow.com/questions/10330936
复制相似问题