这里是我的代码的FB.login的权限对话框stucks在IE9
<!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的权限对话框stucks见下文
铬它的工作原理,但与此错误
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文档中描述的相同的代码。
有帮助吗?
如果需要,我可以提供更多细节。我没有任何选择。
谢谢
'的http://本地主机:63651 /计划/'似乎对我来说,你试图在localhost中测试它..在我的情况下FB连接只适用于preprod或prod服务器,我必须配置我的FB应用程序与这些域.. – pleasedontbelong
谢谢@pleasedontbelong。这工作正常。 – Nnp