Facebook Connect 按钮未显示在 Safari/Chrome 中
我的 Facebook Connect 实现(只是一个简单的登录按钮,fb:login-button)在 Firefox 和 IE 上完美运行。
但相同的按钮没有显示在 Safari/Chrome (Webkit) 中。
讽刺的是。 在我的调试工作中,我将页面(包含 fb:login-button)保存为静态页面,然后将其加载到 Safari 中。 按钮出现,一切正常!
我的 PHP 呈现的完全相同的页面(具有完全相同的 HTML 源代码)无法调出该按钮。
我正在努力支持 Webkit,但我已经快要放弃了。 有人可以帮忙吗?
My implementation of Facebook Connect (just a simple login button, fb:login-button) works perfectly on Firefox and IE.
But the same button is not showing up in Safari/Chrome (Webkit).
Here's what's ironic. In my debugging effort, I saved the page (that contains fb:login-button) up as a static page and then load it in Safari. And the button shows up, everything works!
The exact same page (with the exact same HTML source) rendered by my PHP has no way for bringing up the button.
I'm trying hard to support Webkit here but I'm close to giving up. Can anybody help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
我发现了另一种可能发生这种情况的方式(责备自己愚蠢的方式); 这可能并不常见,但万一可以省去其他人的麻烦,那就是:
这种症状也可能是由各种安全工具阻止 Facebook 资源引起的。
就我而言,我很久以前就在 Chrome 中安装了 Facebook Disconnect 作为插件,但完全忘记了它的安装。 我还安装了第二个 Chrome,看起来完全相同(但没有 Facebook Disconnect)。 第一个将正确加载 fb:login-button,而另一个则不会; 我花了很长时间才看到这些插件,因为 Facebook Disconnect 没有图标,所以我很容易错过它的存在。
如果某种安全插件阻止加载 Facebook 资源,您将看到以下内容。 只需查看使用开发人员工具在浏览器中呈现的 html 即可。
在正常的 Chrome 会话中,您最终会看到如下内容:
但是在禁用 facebook 资源的版本中,您最终会得到这样的结果:
就像我说的,回想起来非常明显。
I found one more way this can occur (the blame-myself-for-being-stupid way); it's probably not common, but in the event is saves anyone else the hassle, here it is:
This symptom can also be caused by various security tools blocking facebook resources.
In my case, I'd installed Facebook Disconnect ages ago in Chrome as a plugin and forgotten all about it being installed. I also had a second installation of Chrome that was seemingly identical (but did not have Facebook Disconnect). The first would properly load the fb:login-button, and the other would not; took me ages before I looked at the plugins, because Facebook Disconnect didn't have an icon and so its presence was pretty easy for me to miss.
Here's what you'll see if some sort of security plugin is preventing facebook resources from loading. Just look at the html that renders in the browser using developer tools.
In a normal chrome session you'll end up with something like this:
<fb:login-button><a class="fb_button fb_button_medium"><span class="fb_button_text">Your text here</span></a></fb:login-button>
But in the version with facebook's resources disabled you'll end up with this:
<fb:login-button>Your text here</fb:login-button>
Like I said, pretty obvious in retrospect.
遇到了同样的问题,但它与插件或格式错误的内容无关。 看来如果您在 Facebook 页面上启用国家/地区过滤,那么“赞”按钮就会出现问题,这应该是相当明显的。 Facebook 从您的个人资料而不是您的 IP 地址获取您的位置。
如果您打算使用社交插件,请确保禁用国家/地区锁定。
Had the same problem but it was not related to anything like a plugin or malformed content. It seems if you enable country filtering on your facebook page it has an issue with the like button, this should be fairly obvious. Facebook gets your location from your profile and not your IP address.
Make sure to disable country locking if you plan on using the social plugins.
这可能是由于安装了 ClickToFlash。 禁用它,或在 ClickToFlash 设置中选中“自动加载不可见的 Flash 视图”。
This can be due to having ClickToFlash installed. Either disable it, or check "Automatically load invisible Flash views" in the ClickToFlash settings.
我们发现,如果您的页面带有 XHTML 响应标头( >application/xhtml+xml)。
使用 text/html 解决了这个问题。
对于我们使用的 JSF2,实现修复就像包装 FB 按钮一样简单:
此处的 Facebook 错误报告:
http://bugs.developers.facebook.net/show_bug.cgi?id=5545
What we found out is that Safari (and maybe some older versions of Chrome or other WebKIT browsers) have a problem with Facebook's code using the innerHTML JS function if your page arrives with an XHTML response header (application/xhtml+xml).
Using text/html solves the issue.
In case of JSF2, which we use, the implementing the fix was as simple as wrapping the FB button like this:
Facebook bug report here:
http://bugs.developers.facebook.net/show_bug.cgi?id=5545
我遇到了 Facebook 按钮根本不显示的问题,我花了很长时间才弄清楚它是什么。 幸运的是,经过几天的拉扯,我现在将答案与大家分享。 在我的情况下,我根本没有启用 xfbml。 在我的 FB.init 中,我将其设置为 false:
我将其更改为“true”(xfbml),并且登录按钮现在工作得很好! :P 祝你好运!
I had this problem with the Facebook button not showing at all and it took me forever to figure out what it was. Luckily after days of hair pulling I will now share the answer with everyone. In my situation I simply didn't have xfbml enabled. In my FB.init I had it set to false:
I changed this to "true" (xfbml) and the login buttons works great now! :P Good luck!
当我在 config/facebooker.yml 中的 callback_url 中使用错误的域时,就会发生这种情况。 显然它使用它来加载 js 文件。
This happened when I had the wrong domain in callback_url in config/facebooker.yml. Apparently it uses that to load the js files.
我遇到了同样的问题,但我通过确保应用程序设置中的 URL 与我的网站的 URL 完全相同来解决它(即,当我在没有 www 的情况下访问我的网站时,它不起作用)。
I had the same problem but I resolved it by making sure the URL in my app settings was exactly the same as the one for my site (i.e. it didn't work when I accessed my site without the www.).
我已经尝试了这里建议的所有解决方案,但它对我不起作用。 但现在我终于找到了解决办法。
Facebook 现在需要 Canvas 的安全 (https)(安全 Canvas URL)。 无安全保障的版本很快就会被弃用。
主要区别在于,Chrome 不喜欢带有无效认证的 https 连接。 在本地主机上,您很可能安装了 stunnel 以允许本地主机进行 https 连接。 Firefox 可以使用自行创建的 SSL 证书,并允许您在尝试访问该站点时添加例外。 Chrome 不允许它开箱即用。
当我在 Chrome 中加载应用程序时,页面为空白,并且看不到任何登录按钮。
单击 F12 并单击 Chrome 中的 Netwrok 选项卡:
您会看到对本地主机的 POST 请求已取消。 双击它。
现在您会看到 chrome 由于证书而阻止了本地主机:
单击继续。
现在返回到其他选项卡并重新加载页面:
Chrome 现在像 Firefox 一样工作并显示登录按钮。
I have tried every suggested solution here and it didn't work for me. But now I finally found the solution.
Facebook requires now a secured (https) for Canvas (Secure Canvas URL). The unsecured one will be deprecated soon.
Here is the main difference, Chrome doesn't like https connections with invalid certifications. On a localhost, it is very likely you have stunnel installed to allow https connection for the localhost. Firefox is ok with the self created SSL certificate and allows you to add an exception when trying to access that site. Chrome doesn't allow it out of the box.
When I load my app in Chrome the page is blank and I dont see any login button.
Click F12 and click the Netwrok tab in Chrome:
You see that the post request to your localhost is cancelled. DOUBLE Click on it.
Now you would see that chrome is blocking the localhost because of the certificate:
click on proceed anyway.
Now to back to your other tab and reload the page:
Chrome works now like Firefox and shows the login button.