2

我设置了一个 FB.ui 提要来触发与 Facebook 的对话,就像这里描述的那样。

到目前为止一切正常。该对话框发布在 fb 用户配置文件上,但是当 fb 站点打开用户操作以发布对话框时,它会在 js 控制台中引发数百次错误,直到用户跳过或发布:

错误(130 次):不安全的 JavaScript 尝试使用 URL ... 访问框架。域、协议和端口必须匹配。

使用 i初始化fbjs sdk 的 appId 已在使用的域中注册:

sub.mydomain.com

交出来的json是这样的:

代码:

window.fbAsyncInit = function() {
    FB.init({appId: '209836882377466', status: true, cookie: true,
        xfbml: true
    });             
};          
(function() {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
    if (!$('#fb-root script').length>0){
        document.getElementById('fb-root').appendChild(e);
    }

}());

这里的提要:

 var jSON = {
                method: 'feed',
                name: $('#fbName input').val(),
                link: basicLnkStruct + phpSessionID,
                picture: homeURL + imgPath,
                caption: ' ',
                description: $('.fbDescript textarea').val(),
                message: ''
            };
    FB.ui(
        jSON
        ,
        function(response) {
            if (response && response.post_id) {
                 //alert('Post was published.');
            } else {
                //alert('Post was not published.');
            }
        }

    );

为什么会抛出该错误?

4

1 回答 1

1

This was addressed in another thread: "Unsafe JavaScript attempt to access frame with URL..." error being continuously generated in Chrome webkit inspector

于 2011-04-13T16:37:41.490 回答