Facebook Connect 按钮未显示在 Safari/Chrome 中

发布于 2024-07-17 18:20:03 字数 336 浏览 5 评论 0原文

我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

神回复 2024-07-24 18:20:03

我发现了另一种可能发生这种情况的方式(责备自己愚蠢的方式); 这可能并不常见,但万一可以省去其他人的麻烦,那就是:

这种症状也可能是由各种安全工具阻止 Facebook 资源引起的。

就我而言,我很久以前就在 Chrome 中安装了 Facebook Disconnect 作为插件,但完全忘记了它的安装。 我还安装了第二个 Chrome,看起来完全相同(但没有 Facebook Disconnect)。 第一个将正确加载 fb:login-button,而另一个则不会; 我花了很长时间才看到这些插件,因为 Facebook Disconnect 没有图标,所以我很容易错过它的存在。

如果某种安全插件阻止加载 Facebook 资源,您将看到以下内容。 只需查看使用开发人员工具在浏览器中呈现的 html 即可。

在正常的 Chrome 会话中,您最终会看到如下内容:

Your text here< ;/span>

但是在禁用 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.

画尸师 2024-07-24 18:20:03

遇到了同样的问题,但它与插件或格式错误的内容无关。 看来如果您在 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.

难得心□动 2024-07-24 18:20:03

这可能是由于安装了 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.

私藏温柔 2024-07-24 18:20:03

我们发现,如果您的页面带有 XHTML 响应标头( >application/xhtml+xml)。
使用 text/html 解决了这个问题。

对于我们使用的 JSF2,实现修复就像包装 FB 按钮一样简单:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:fb="http://www.facebook.com/2008/fbml"
    xmlns:f="http://java.sun.com/jsf/core">

...

    <f:view contentType="text/html">
        <fb:login-button>Login using Facebook</fb:login-button>
    </f:view>

此处的 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:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:fb="http://www.facebook.com/2008/fbml"
    xmlns:f="http://java.sun.com/jsf/core">

...

    <f:view contentType="text/html">
        <fb:login-button>Login using Facebook</fb:login-button>
    </f:view>

Facebook bug report here:
http://bugs.developers.facebook.net/show_bug.cgi?id=5545

饮惑 2024-07-24 18:20:03

我遇到了 Facebook 按钮根本不显示的问题,我花了很长时间才弄清楚它是什么。 幸运的是,经过几天的拉扯,我现在将答案与大家分享。 在我的情况下,我根本没有启用 xfbml。 在我的 FB.init 中,我将其设置为 false:

    FB.init({
        appId       : 'app_id', // App ID
        status      : true, // check login status
        cookie      : true, // enable cookies to allow the server to access the session
        xfbml       : false,  // parse XFBML
        oauth       : true // enable OAuth 2.0
    });

我将其更改为“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:

    FB.init({
        appId       : 'app_id', // App ID
        status      : true, // check login status
        cookie      : true, // enable cookies to allow the server to access the session
        xfbml       : false,  // parse XFBML
        oauth       : true // enable OAuth 2.0
    });

I changed this to "true" (xfbml) and the login buttons works great now! :P Good luck!

白衬杉格子梦 2024-07-24 18:20:03

当我在 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.

滥情空心 2024-07-24 18:20:03

我遇到了同样的问题,但我通过确保应用程序设置中的 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.).

海未深 2024-07-24 18:20:03

我已经尝试了这里建议的所有解决方案,但它对我不起作用。 但现在我终于找到了解决办法。

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.

enter image description here

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:

enter image description here

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:

enter image description here

click on proceed anyway.

Now to back to your other tab and reload the page:

enter image description here

Chrome works now like Firefox and shows the login button.
enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文