Several xml errors using Facebook JS SDK with xhtml strict

1k views Asked by At

I'm trying to set up some like buttons to a project. These buttons live inside a jquery slideshow with Aino's Galleria and let you "Like" each different slide. I'm using an xHTML strict document and while in Firefox (and Firebug) everything seems ok, but in webkit inspector I get this:

   XML self-closing tag syntax used on <fb:like>. The tag will not be closed.
   [The HTML that caused this error was generated by a script.] XML self-closing tag syntax used on <fb:like>. The tag will not be closed.

I get one of these every slide, so there are 28 errors. Looking into it, found some seem to enclose the fb:like into something like this:

<script type="text/javascript">
//<![CDATA[
document.write('<fb:like href="<?php echo "http://www.site/image-".$image_id ;?>" width="260" height="80" show_faces="false" />');
//]]>
</script>

The above, still works in Firefox, but not in Safari. The inspector says:

26 XFBML tags failed to render in 30000ms.

Moreover, for the Facebook like buttons to work with the Galleria Jquery plugin, I have a custom function that reloads only the facebook like button concerning the actual slide which appears briefly upon loading the slide:

[...]
extend: function(options) {
       // listen to when an image is shown
       this.bind(Galleria.IMAGE, function(e) {
            number = e.index + 1;
        tag = $('.galleria-info-description .info-box-'+number).find('.btn_fb');
    $(tag).each(function() {
            FB.XFBML.parse( this );
        });
    });
}

This thing is getting more complex and really don't know who is causing the problem! Hope somebody can help or ask the right questions!

3

There are 3 answers

0
Jimmy Sawczuk On BEST ANSWER

Add this attribute to your <html> tag:

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

If that doesn't work, you could try generating the buttons in iFrame form instead of using the XFBML tags.

0
DigiKev On

The code that you are trying to use here is part of the Open Social DTD. XHTML Strict is not able to parse this code, it is not part of the spec and is therefore invalid.

Take a look at the documentation for Facebook Open Social and you will see that the document must be marked up with a very different DTD.

0
Sindre Sorhus On

Try using HTML5 instead, it's not as strict as XHTML and especially XHTML strict. XHTML is dead anyway.