在IE中使用Fb.login时,Facebook登录弹出窗口保持打开状态 [英] Facebook login popup window stays open when using Fb.login in IE

查看:348
本文介绍了在IE中使用Fb.login时,Facebook登录弹出窗口保持打开状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我的网站上进行Facebook登录,我一直在使用新的Facebook Javascript SDK的FB.Login功能。



登录功能完美FireFox和Chrome。登录也可以在IE中使用,但是问题在于Facebook的弹出窗口保持打开空白(用户根据需要登录并重定向)。有没有人知道IE的秘密,以便弹出窗口关闭?



这是我的代码: (它是一个asp.net mvc网站,所以这是在一个副视图)

 < div id =fbLoginS类=smallloginbutton facebooksmall> Facebook登录< / div> 
< div id =fb-root>< / div>
<! - facebook login - >
< script type =text / javascriptsrc =http://connect.facebook.net/en_US/all.js>< / script>
< script type =text / javascript>
<%string Facebookaction = Url.Action(FacebookLogOn,Account);%>

FB.init({appId:'<%:FacebookSettings.Current.AppId%>',status:true,cookie:true,xfbml:true});
$('#fbLoginS')。click(function(){
FB.login(function(response){
if(response.session){
window.location = '<%:facebookaction%>';
} else {
//用户取消登录
}
},{perms:email});
});
< / script>
<! - facebook login - >

非常感谢帮助,
Apolka

解决方案

也许会帮助某人,所以这里是解决方案:




I am trying to do facebook login on my web site, and I have been using the new Facebook Javascript SDK's FB.Login function.

The login works perfectly in FireFox and in Chrome. The login works in IE as well, however the problem is that the facebook popup window stays open blank (user is logged in and redirected, as needed).

Does anyone know any secret for IE so that the popup window will close?

Here is my code: (it is an asp.net mvc site so this is in a parial view)

 <div id="fbLoginS" class="smallloginbutton facebooksmall">Facebook Login</div>
 <div id="fb-root"></div>
 <!-- facebook login -->
 <script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
    <script type="text/javascript">
        <% string facebookaction = Url.Action("FacebookLogOn", "Account");%> 

        FB.init({ appId: '<%:FacebookSettings.Current.AppId %>', status: true, cookie: true, xfbml: true });
        $('#fbLoginS').click(function () {
            FB.login(function (response) {
                if (response.session) {
                    window.location = '<%:facebookaction %>';
                } else {
                    // user cancelled login
                }
            }, { perms: "email" });
        });
    </script>
     <!-- facebook login -->

Thanks a lot for the help, Apolka

解决方案

Maybe it will help someone, so here is the solution:

  • In IE if you configure a port in your site link (i.e. http://localhost:1234) the whole facebook connect does not work at all
  • If you just use http://localhost then the login works however the popup stays open blank as described in the question
  • If you use http://127.0.0.1 or your productiton URL everything works fine :)

这篇关于在IE中使用Fb.login时,Facebook登录弹出窗口保持打开状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆