Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook: Invalid mark up on FBML

Tags:

fbml

I am using the W3C XHTML validator to check my sites and I am getting some errors on pages with FBML. Most of the cause of such errors is the "&" character. Since FBML values and attributes are generated on the fly, I have no way to encode the character properly before displaying it.

Question: Is there a way for me to tell Facebook Connect to render the mark up properly?

Thanks.

like image 213
Jhourlad Estrella Avatar asked Jun 16 '10 13:06

Jhourlad Estrella


2 Answers

Try to put the 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>
like image 134
Vasil Dakov Avatar answered Oct 04 '22 11:10

Vasil Dakov


In short, not as far as I know. To make matters worse, the fb:* tags don't validate either, even if you make your html tag look like this:

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

If this is a huge issue for you, you might be able to get away with putting non-XHTML-compliant markup in its own HTML-4.01-strict iframe, to basically sweep the crap under the rug.

This might be helpful:

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

Some german guy also worked on it:

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

like image 23
Reinderien Avatar answered Oct 04 '22 10:10

Reinderien