FB.getLoginStatus不调用其回调 [英] FB.getLoginStatus not calling its callback

查看:95
本文介绍了FB.getLoginStatus不调用其回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标题真的说了这一切。在某些(未确定)条件下,FB.getLoginStatus()只是停止工作,不会调用我给它的回调。我发现的唯一有趣的线索是




  • FB.Auth._loadState被卡在加载 - 无论是应该如何点击加载不发生

  • 稍微延迟,像放置 alert()调用往往使它开始工作



任何提示甚至可以调查这个欢迎。

解决方案

当我在与Facebook注册的不同域名下运行页面时,通常会发生这种情况。通常情况下,我正在本地开发。



如果您在本地运行,则必须设置本地Web服务器,然后修改主机文件,以指出注册域为127.0.0.1,以便在本地机器上进行测试。当您要在服务器上测试时,请勿忘记从主机文件中删除该行。


The title really says it all. Under some (undetermined) conditions FB.getLoginStatus() just stops working and won't invoke the callback I gave it. The only interesting clues I've found are

  • FB.Auth._loadState is stuck on "loading" -- whatever is supposed to make it click over to "loaded" isn't happening
  • slight delays like putting in alert() calls tend to make it start working

Any hints at all about even how to investigate this welcome.

解决方案

This usually happens for me when I am running the page under a different domain from what has been registered in Facebook. Typically this is when I am developing locally.

If you are running locally, you'll have to set up a local web server and then modify your hosts file to point the the registered domain to 127.0.0.1 in order to test on your local machine. Don forget to remove that line from the hosts file when you want to test it on the server.

这篇关于FB.getLoginStatus不调用其回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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