7

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?

Collector
  • 2,034
  • 4
  • 22
  • 39

3 Answers3

7

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.

Collector
  • 2,034
  • 4
  • 22
  • 39
2

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.

sakibmoon
  • 2,026
  • 3
  • 22
  • 32
domoindal
  • 1,513
  • 2
  • 17
  • 33
  • Please try to explain how your code is different as the only notable difference between your code and mine is the FB.XFBML.parse('fb-stuff'); – Collector Jan 16 '11 at 05:09
  • Thanks. I add the like button dynamically, and only after I added FB.XFBML.parse('parent div object') - it started showing in IE9...! – Yuval A. Oct 17 '12 at 16:12
0

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

ripper234
  • 222,824
  • 274
  • 634
  • 905