Search code examples
internet-explorerinternet-explorer-8facebookxfbml

Facebook Login/Like Fail on IE8


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?


Solution

  • 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.