Facebook Connect错误-JavaScript刷新 [英] Facebook Connect Bug - JavaScript Refresh

查看:76
本文介绍了Facebook Connect错误-JavaScript刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Facebook Connect有一个最近的错误,该错误导致权限弹出窗口无法按设计进行关闭和刷新父窗口.相反,在获得用户批准后,它会尝试直接在弹出式窗口中加载页面,这是一种糟糕的用户体验,并确实损害了我们的注册.您可以通过使用Facebook Connect注册我们的网站来查看该错误: http://alltrails.com

Facebook Connect has a recent bug that is causing the permissions pop-up window to not close and refresh the parent window as it is designed to do. Instead, after approval by the user it attempts to load the page directly in the pop-up window which is an awful user experience and really hurting our registrations. You can see the bug by registering for our site using Facebook Connect: http://alltrails.com

用户连接后,在权限弹出窗口中不正确加载Facebook Connect的页面的URL格式为:

The URL of the page after the user connects that Facebook Connect is incorrectly loading in the permissions pop-up window is of the form:

http://alltrails.com/?installed=1&session={"session_key":"2.Gu0duOqdElNjXRac5wnetw__.3600.1283799600-1486832834","uid":1486832834,"expires":1283799600,"secret":"tKFaEgBTF9RJeuQZfYUSCw__","base_domain":"alltrails.com","sig":"a8dd9f75418b530ae6c3d935e14274c4"}

我希望精通JavaScript的人能提出一个比我本人好得多的代码段,然后将其添加到我们的首页中,只有在页面URL包含?installed = 1"时才能调用该代码段,并且可以执行以下操作:允许与Facebook Connect旨在提供相同的用户体验:

I'm hoping that someone much better at JavaScript than myself could suggest a simple code snippet that we could add to our homepage that would only be invoked if the page URL includes '?installed=1' and would do the following to allow the same user experience as Facebook Connect was intended to provide:

  1. 关闭权限弹出窗口
  2. 在原始父级中加载相应的页面 http://alltrails.com/register/facebook 窗口

我尝试了多种方法来实现此目的,但是并没有使它能够正常工作的运气.预先感谢您的帮助!

I've tried to do this a bunch of different ways but haven't had any luck with getting it to work correctly. Thanks in advance for your help!

推荐答案

这是一个(未确认的)错误.

It's a (unconfirmed) bug.

http://bugs.developers.facebook.net/show_bug.cgi ?id = 12260

希望它能获得更多选票,从而得到固定-投票给人们!

Hopefully it gets more votes so it gets fixed - vote people!

同时,我(尝试)采用以下创造性解决方法":

In the meantime, i am (attempting) to employ the following 'creative workaround':

  1. 将逻辑添加到我的Default.aspx页面,以检测弹出菜单中重定向到的URL.
  2. 重定向到我的页面,FacebookInboundAuthorization.aspx,保留查询字符串.
  3. 在加载该页面时,注册一些JavaScript以关闭弹出窗口,并为我的按钮手动触发"onlogin"事件处理程序.

编辑-另一种可能的解决方案

因此,我对从Facebook断开连接"按钮执行了类似的操作,该按钮具有从第一天起就出现在FBC中的类似错误.如果用户已经登录,则单击从Facebook断开连接"按钮,则不会触发"onlogin"处理程序.

So i do something like this for the "Disconnect from Facebook" button, which has a similar bug which has been in FBC from day 1. If the user is already logged in, and you click the "Disconnect from Facebook" button, the "onlogin" handler is not fired.

所以我最终要做的是用我自己的常规锚标签替换Facebook Disconnect按钮,模仿Facebook CSS.这样,我可以完全控制click事件(触发我想要的功能).

So what i ended up doing is replacing the Facebook Disconnect button with my own regular anchor tag, mimicing the Facebook CSS. This way i can have full control over the click event (fire the function i want).

因此,该原理可以(理论上)应用于当前的错误.

So, this principle could (theoretically) be applied to this current bug.

也就是说,在客户端上执行FB.Init之后:

That is, after you do FB.Init on client-side:

  1. 使用FB.Connect.ifUserConnected检查FB身份验证状态
  2. 如果已连接用户,请隐藏常规的FB:Login按钮,并显示伪造的" FB Login按钮.通过onclick事件将常规FB:Login按钮的"onlogin"功能复制到假按钮.

您的假FB登录按钮将是一个常规锚标记,并且将相同的CSS应用于常规FB登录按钮.

Your Fake FB Login button would be a regular anchor tag, with the same CSS applied to the regular FB Login buton.

因此,从本质上讲,如果用户已经连接,我们实际上不需要FB进行身份验证,我们就可以做我们想做的任何事情(请求权限,重定向等).

So essentially, if the user is already connected, we don't really need FB's intervention for authentication, we can just do whatever we want (request perms, redirect, etc).

应该可以.

不幸的是,我需要处理的工作具有更高的优先级,但这听起来对您来说是最优先的.

Unfortunately i have higher priority things i need to work on, but it sounds like this is top priority for you.

因此,请放手,希望对您有所帮助.

So give that a go, hope it helps.

这篇关于Facebook Connect错误-JavaScript刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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