Facebook: FBML tag malformed

I use the W3C XHTML validator to check my sites and I get some errors on FBML pages. The main reason for such errors is "&". character. Since FBML values ​​and attributes are generated on the fly, I have no way to correctly encode a character before displaying it.

Question: Is there a way to tell Facebook Connect to tag correctly?

Thank.

+5
source share
3 answers

Try entering your facebook code in CDATA:

<script type="text/javascript">
/* <![CDATA[ */ 
document.write('<fb:login-button length="long" size="large" show-faces="true" perms="" onlogin="window.location=\'<?=current_url()?>\'"></fb:login-button>'); 
/* ]]> */
</script>
+7
source

In short, I do not know. Worse, fb: * tags are also not checked, even if you create your html tag as follows:

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

, -XHTML- iframe HTML-4.01, .

:

http://wiki.developers.facebook.com/index.php/Facebook_Platform_for_Mobile:_XHTML

:

http://translate.google.com/translate?js=y&prev=_t&hl=en&ie=UTF-8&layout=1&eotf=1&u=http%3A%2F%2Fwww.ka-mediendesign.de%2Fblog%2Ffbml-in-xhtml-neue-version%2F&sl=de&tl=en

+2

This is how I do it. Wrap all the fbml tags inside, and then use js to simply uncomment the fbml code using javascript. Here is an example:

Markup:

<P class="fbreplace" style="display: none;">
    <!-- FBML
        <fb:like layout="standard" show_faces="false" colorscheme="light"></ fb: like>
    ->
</ p>

JS (jQuery required):

$(document).ready(function() {
  $(".fbreplace").html.replace(/<!-- FBML /g, "");
  $(".fbreplace").html.replace(/ -->/g, "");
  $(".fbreplace").style.display = "block";
});
+1
source

All Articles