2012-01-07 190 views
0

我正在使用connect-js(FB.login)以标准方式登录用户以共享我的页面。在所有普通浏览器(chrome,firefox,opera)中,它会弹出一个包含权限请求的窗口(一切正常)。但在Internet Explorer中(7和8,未在6中测试),它会弹出一个窗口,其中显示:“[myapp]发生错误,请稍后再试。”Internet Explorer中的FB.login错误

这是我的代码:

<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> 

+1

错误总是发生IE .. – JohnJohnGa 2012-01-07 01:18:46

回答

2

你有没有尝试添加P3P头?这是一个IE浏览器,并清除了很多问题。然而,这些代码是神秘的。 Facebook本质上试图做的是跨域共享cookie,这是一个安全标志。你需要说没关系。

+0

是啊,什么布伦特说:)看到这里的p3p标题的详细解释http://www.hanselman.com/blog/TheImportanceOfP3PAndACompactPrivacyPolicy.aspx – DMCS 2012-01-07 03:35:59

+0

tks,我尝试设置p3p,然后做了,我回来了分享我的评论。 – 2012-01-16 21:10:28

1

的问题可能是在channelUrl,尽量让整个路径,即有http://emocionesverde.com/channel.html

此外,请登录到Facebook上的应用程序开发人员 - 错误信息会更加详细的