我使用connect-js(FB.login)以标准方式登录用户以共享我的页面。在所有普通的浏览器(chrome,firefox,opera)中,它会弹出一个带有权限请求的窗口(一切都很好)。但是在Internet Explorer(7和8,未在6中测试)中,它会弹出一个窗口,显示:“[myapp]发生错误。请稍后再试。”
这是我的代码:
<div id="fb-root"></div>
<script language="javascript">
var nombre = "";
var pic_big = "";
FB.init({
appId : '161599150607341', // App ID
channelUrl : '//emocionesverde.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
});
function conectarse() {
FB.login(handleSessionResponse, {
scope: 'publish_stream, user_about_me'
});
}
function handleSessionResponse(response) {
if (response.authResponse) {
FB.api('/me', function(response) {
//console.log(response.name);
window.nombre = response.name;
getUserPic(response.id);
});
}
}
function getUserPic(uid) {
FB.api('/me?fields=picture&type=large', function(response) {
//console.log(response.picture);
window.pic_big = response.picture;
publicar();
});
}
function publicar() {
FB.ui({
method: 'stream.publish',
message: '',
attachment: {
name: 'Emoción es Verde',
caption: window.nombre + ' midió el impacto de sus acciones verdes. Te invitamos a conocer acciones para mantener el planeta verde con Emoción es Verde',
media: [{
type: 'flash',
swfsrc: 'http://mainteractivetools.com/erik/mifb/emocionesverde/Prueba.swf?pic=' + window.pic_big + '&nombre=' + window.nombre,
imgsrc: 'http://mainteractivetools.com/erik/mifb/emocionesverde/telefonica1.jpg',
expanded_width: '450',
expanded_height: '258'
}],
href: 'http://www.emocionesverde.com'
},
action_links: [{
text: 'Emoción es Verde',
href: 'http://www.emocionesverde.com'
}],
user_message_prompt: 'Escribe un comentario'
}, function (response) {});
}
$('#swfmapsdiv').css('visibility', 'hidden');
</script>
答案 0 :(得分:2)
您是否尝试过添加p3p标头?这是一个IE的东西,并解决了很多问题。然而,代码是神秘的。 Facebook实际上要做的是跨域共享cookie,这是一个安全标志。你需要说没关系。
答案 1 :(得分:1)
问题可能在channelUrl中,尝试在那里有整个路径,即http://emocionesverde.com/channel.html
还以app开发者身份登录facebook - 错误消息将更加详细