2012-04-01 59 views
0

我在我的Facebook多朋友選擇器對話框上按「發送請求」時出現以下錯誤。Facebook多朋友選擇器對話框失敗?

Unsafe JavaScript attempt to access frame with URL https://s-static.ak.fbcdn.net/connect/xd_proxy.php#cb=f13538d5d4&origin=http%3A%2F%2Fjoincrowdy.com%2Ff3b62245cc&relation=opener&transport=postmessage&frame=f145be71f&result=%7B%22request%22%3A%22271624056256532%22%2C%22to%22%3A[%22122614229%22]%2C%22updated_frictionless%22%3Afalse%7D from frame with URL http://MYAPP.com/rooms/1. Domains, protocols and ports must match. 

我本來正在制定關於myapp.com:3000但這個錯誤促使我嘗試通過生產模式(80端口)發送應用程序的請求。這並沒有解決問題。

注意:我在我的/ etc/hosts中添加了127.0.0.1 myapp.com是否會導致此錯誤?

這是我的代碼:

function initFb() { 
    window.fbAsyncInit = function() { 
    FB.init({ 
     appId  : user.fbAppId, 
     frictionlessRequests: true, 
     status  : true, // check login status 
     cookie  : true, // enable cookies to allow the server to access the session 
    }); 
    // Additional initialization code here 
    }; 

    // Load the SDK Asynchronously 
    (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)); 
} 

function attachInviteButton() { 
    $("#invite").click(sendRequestViaMultiFriendSelector); 
} 

function sendRequestViaMultiFriendSelector() { 
    FB.ui({ 
    method: 'apprequests', 
    message: 'Invite your friends to play now.', 
    }, requestCallback); 
} 

function requestCallback() { 
} 

回答

0

如果你看的JavaScript SDK documentation你會看到,當他們撥打FB.init他們提供了一個頻道網址:

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 
    xfbml: true // parse XFBML 
}); 

你還沒有。 在同一頁面中,在頻道文件部分有一個解釋,它是如何提供它的好處和如何提供它。

上面清清楚楚地寫着:

頻道文件在某些​​瀏覽器

該解決方案解決了跨域通信 某些問題可能解決這個問題你。

相關問題