Facebook 登录/点赞在 IE8 上失败

发布于 2024-09-23 23:53:05 字数 215 浏览 1 评论 0原文

我最近使用 XFBML 实现了 Facebook 登录按钮和 Facebook“喜欢”按钮。您可以在 http://colnect.com 上查看该

网站野生动物园。

但是,IE 既不显示“登录”也不显示“喜欢”按钮,也没有错误消息。

有什么想法吗?

I've recently implemented Facebook Login button and a Facebook "Like" button using XFBML. You can see the site on http://colnect.com

Everything works well with FireFox, Chrome, Opera & Safari.

However, IE doesn't show neither "login" or "like" buttons and no error message is available as well.

Any ideas?

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

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

发布评论

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

评论(3

温柔嚣张 2024-09-30 23:53:05

看来我会是那种自己回答的人,希望它能对某人有所帮助。

为了使 Internet Explorer 能够识别 Facebook,您应该添加

xmlns:fb="http://www.facebook.com/2008/fbml"

到您的 html 标签,对我来说这是

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en">

我遇到的第二个问题是 IE 不支持 Array.indexOf() 所以这里是解决它的方法:

if(!Array.indexOf){
  Array.prototype.indexOf = function(obj){
          for(var i=0; i<this.length; i++){
              if(this[i]==obj){
                  return i;
              }
          }
      return -1;
  }
}

希望它有帮助。

Seems I'll be the kind of person to answer himself hoping it'll help someone.

For Internet Explorer to recognize Facebook you should add

xmlns:fb="http://www.facebook.com/2008/fbml"

to your html tag, for me it's

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en">

The second problem I had was that IE doesn't support Array.indexOf() so here's the way around it:

if(!Array.indexOf){
  Array.prototype.indexOf = function(obj){
          for(var i=0; i<this.length; i++){
              if(this[i]==obj){
                  return i;
              }
          }
      return -1;
  }
}

Hope it helps.

一瞬间的火花 2024-09-30 23:53:05

我用这段代码解决了我的问题。解决方案的其余部分不适用于我的情况。

<script>

    window.fbAsyncInit = function() {
        FB.init({
          appId  : '330984983742',
          status : true, // check login status
          cookie : true, // enable cookies to allow the server to access the session
          xfbml  : true  // parse XFBML
        });
    };

    (function() {
        var e = document.createElement('script');
        e.src = document.location.protocol + '//connect.facebook.net/<?php echo ($_SESSION["lang"]=="es")?"es_ES":"en_US"; ?>/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
        FB.XFBML.parse('fb-stuff'); 
    }());

</script>

我希望它能帮助别人。

I solved my issue with this code. Rest of the solution didn't work for my case.

<script>

    window.fbAsyncInit = function() {
        FB.init({
          appId  : '330984983742',
          status : true, // check login status
          cookie : true, // enable cookies to allow the server to access the session
          xfbml  : true  // parse XFBML
        });
    };

    (function() {
        var e = document.createElement('script');
        e.src = document.location.protocol + '//connect.facebook.net/<?php echo ($_SESSION["lang"]=="es")?"es_ES":"en_US"; ?>/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
        FB.XFBML.parse('fb-stuff'); 
    }());

</script>

I hope it will help someone else.

强者自强 2024-09-30 23:53:05

对我来说,这个技巧的一贯作用就是将 class='fb-like' 添加到 标记中。

For me what did that trick consistently was adding class='fb-like' to the <fb:like> tag.

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