2013-06-22 36 views
0

我收到了一個Canvas網址錯誤,如下圖所示,我不清楚。我不清楚它來自哪裏..我在FB.init()之前和之後進行調試,並且都打印出來。我的應用程序在「選擇您的應用程序與Facebook集成的方式」下配置爲「僅限帶Facebook登錄的網站」,因此我沒有在任何地方指定畫布URL(沒有選項可以這樣做)。我唯一擁有的是「應用程序域名」和「網站網址」,以及我已將這兩個設置爲我的網站網址(www.blah-blah.com)。 我的代碼在錯誤之後,但我不知道下面的錯誤來自哪裏。有什麼想法嗎? 「畫布網址相關錯誤

錯誤: 」應用程序配置不允許給定URL:應用程序的設置不允許使用一個或多個給定的URL,它必須與網站URL或Canvas URL匹配,或者域必須是其中一個應用程序域的子域。「

<script> 
    window.fbAsyncInit = function() 
{ 
    console.log("Hello"); 
    FB.init(
    { 
    appId  : 'XXXX', // App ID 
    channelUrl : '//www.XXXX.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 
    }); 
    console.log("Hello2"); 
    FB.Event.subscribe('auth.authResponseChange', function(response) 
    { 
    console.log(response); 
    if (response.status === 'connected') 
    { 
     console.log('Connected case… '); 
     testAPI(); 
    } 
    else if (response.status === 'not_authorized') 
    { 
     FB.login(); 
     console.log('Not authorized case… '); 
    } 
    else 
    { 
     FB.login(); 
     console.log('else case… '); 
    } 
    }); 
}; 
// 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')); 

function doLogout() 
{ 
    FB.logout(function(response) 
    { 
    //console.log(response); 
    alert("Bye bye..."); 
    }); 
} 

function testAPI() 
{ 
    console.log('Welcome! Fetching your information.... '); 
    FB.api('/me', function(response) 
    { 
    console.log('Good to see you, ' + response.name + '.'); 
    }); 
} 
</script> 

回答

0

好吧,我發現這個問題。不知何故,在FB應用程序設置中的某個URL中添加「http」可以神奇地解決我的問題。嘆。