Facebook Like 按钮在 IE8 或 IE9 中不起作用

发布于 2024-12-05 22:52:44 字数 2887 浏览 0 评论 0原文

我已经为此苦苦挣扎了一天多了,终于发布了一个问题,因为我无法弄清楚,也无法从遇到同样问题的人那里找到任何信息。

这些“赞”按钮在 Chrome、Firefox、IE7 中可以正常工作,但在 IE8 和 IE9 中则不行。

Facebook 的专家们知道这里发生了什么吗?这些按钮在生产中工作正常。

但对于这个页面,在 IE8 和 IE8 中IE9,如果您没有登录 Facebook,您会收到一个弹出窗口,提示您登录。成功登录后,您将被转发到(引用您的 url,而不是我的): http://www.facebook.com/connect/connect_to_external_page_widget_loggedin.php?social_plugin=like&external_page_url=http%3A%2F%2Fwebhooks.digitas.com%2Flike.html#=

如果您已经登录,您可以直接访问此网址。正如您所看到的,页面永远不会完成它应该做的事情。

我只是不明白按钮如何在生产中工作,但不能在这个测试页面中工作......

我的测试页面包含 3 个 Like 按钮,直接取自 Like 按钮代码生成器 页面

<!doctype html> 
<html xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
</head>
<body>
    <div id="fb-root"></div>
    <script>(function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) {return;}
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>

    <div class="fb-like" data-href="http://webhooks.digitas.com/like.html" data-send="false" data-layout="button_count" data-width="200" data-show-faces="false"></div>

    <fb:like href="http://webhooks.digitas.com/like.html" send="false" layout="button_count" width="200" show_faces="false"></fb:like>

    <iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwebhooks.digitas.com%2Flike.html&amp;send=false&amp;layout=button_count&amp;width=200&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:200px; height:21px;" allowTransparency="true"></iframe>

</body>
</html>

测试页面位于 http://webhooks.digitas.com/like.html

我也使用加载当前在我们的生产站点上运行的 Facebook JS SDK 的替代方法创建了另一个 页面

<script type="text/javascript">
    window.fbAsyncInit = function() {
        FB.init({ appId: '168861203149296', status: true, cookie: true, xfbml: true });
    };

    (function() {
        var e = document.createElement('script'); e.async = true;
        e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
        document.getElementById('fb-root').appendChild(e);
    } ());

</script>

I've been banging my head against this for over a day now and am finally posting a question, since I can't figure it out nor can find any information out there from people who are experiencing the same issue.

These Like buttons work fine in Chrome, Firefox, IE7, but NOT in IE8 nor IE9.

Do any of you Facebook gurus have any idea what may be going on here? The buttons work fine in production.

But for this page, in IE8 & IE9, if you're not logged in to Facebook, you get a popup prompting you to log in. After successful login, you're forwarded to (referencing you're url, instead of mine):
http://www.facebook.com/connect/connect_to_external_page_widget_loggedin.php?social_plugin=like&external_page_url=http%3A%2F%2Fwebhooks.digitas.com%2Flike.html#=

If you're already logged in, you go straight to this url. As you can see, the page never finishes whatever it's supposed to do.

I just don't understand how a button can work in production, but not in this test page.....

My test page contains 3 like buttons, taken directly from the like button code generator page.

<!doctype html> 
<html xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
</head>
<body>
    <div id="fb-root"></div>
    <script>(function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) {return;}
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>

    <div class="fb-like" data-href="http://webhooks.digitas.com/like.html" data-send="false" data-layout="button_count" data-width="200" data-show-faces="false"></div>

    <fb:like href="http://webhooks.digitas.com/like.html" send="false" layout="button_count" width="200" show_faces="false"></fb:like>

    <iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwebhooks.digitas.com%2Flike.html&send=false&layout=button_count&width=200&show_faces=false&action=like&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:200px; height:21px;" allowTransparency="true"></iframe>

</body>
</html>

The test page is located at http://webhooks.digitas.com/like.html

I also created another page using an alternate method of loading the Facebook JS SDK that currently works on our production site:

<script type="text/javascript">
    window.fbAsyncInit = function() {
        FB.init({ appId: '168861203149296', status: true, cookie: true, xfbml: true });
    };

    (function() {
        var e = document.createElement('script'); e.async = true;
        e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
        document.getElementById('fb-root').appendChild(e);
    } ());

</script>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

吹泡泡o 2024-12-12 22:52:44

您需要做两件事来帮助解决问题。

1) 在 FB.init 中,您应该设置 ChannelUrl。
2) 在您的网络服务器发送的标头中,您必须指定 P3P 标头。请参阅此处了解如何实施:http://www.hanselman.com/blog/TheImportanceOfP3PAndACompactPrivacyPolicy.aspx< /a>

There's two things you will need to do to help things out.

1) In the FB.init you should set the ChannelUrl.
2) In the headers your webserver sends out, you must specify a P3P header. See here for how to implement: http://www.hanselman.com/blog/TheImportanceOfP3PAndACompactPrivacyPolicy.aspx

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