2

这是我的代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title></title>
</head>
<body>
<div id="fb-root">
</div>
<script>
       window.fbAsyncInit = function () {
        FB.init({
            appId: 'XXXXXX', // App ID
            channelUrl: '//localhost:63651/channel.htm', // Channel File
            status: true, // check login status
            cookie: true, // enable cookies to allow the server to access the session
            xfbml: true,  // parse XFBML
            oauth: true
        });

        // 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));
</script>
<input type="button" value="login" id="login" onclick="return login();" />
<script>

    function login() {

        FB.login(function (response) {
            if (response.authResponse) {
                console.log('Welcome!  Fetching your information.... ');
                FB.api('/me', function (response) {
                    alert(response);
                    console.log('Good to see you, ' + response.name + '.');
                });
            } else {
                console.log('User cancelled login or did not fully authorize.');
            }
        }, { scope: 'email,user_work_history,publish_stream' });



    }
</script>
</body>
</html>

所以我的问题是,facebook 对话框卡在 IE9 上的权限上,请参阅下面脸书错误
的 chrome 它可以工作,但出现此错误

Unsafe JavaScript attempt to access frame with URL https://www.facebook.com/dialog/permissions.request from frame with URL http://localhost:63651/plans/. Domains, protocols and ports must match.

我使用了与 fb 文档中描述的相同的代码。

有什么帮助吗?
如果需要,我可以提供更多详细信息。我没有所有选择。
谢谢

4

1 回答 1

1

尝试将 channelURL 文件放在互联网上(没有 localhost url)和默认的 http 端口(80)。问题可能是它无法识别连接的不同端口,或者它希望它在互联网上发布(不是本地主机)

    FB.init({
        appId: 'XXXXXX', // App ID
        channelUrl: '//your-website.com/channel.htm', // Channel File
        status: true, // check login status
        cookie: true, // enable cookies to allow the server to access the session
        xfbml: true,  // parse XFBML
        oauth: true
    });
于 2012-05-31T08:44:59.597 回答