theMikeD
theMikeD

Reputation: 41

Facebook like button needs XHTML+RDFa, but it uses an iframe which isn't valid with that doctype

I think there must be something I'm missing.

  1. the facebook like button requires this as the doctype: < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
  2. The facebook like button is inserted using an iframe
  3. Iframes are invalid with this doctype

Can someone set me straight here?

...Mike

Upvotes: 4

Views: 922

Answers (3)

Dmytro Dzyubak
Dmytro Dzyubak

Reputation: 1642

Currently, it seems that the only way for validator + facebook plugin to work is to use HTML5 doctype

<!doctype html>

Upvotes: 0

Anton Dimitrov
Anton Dimitrov

Reputation: 51

With this

DOCTYPE XHTML+RDFa 1.0

will be work JS

<script type="text/javascript">
$(document).ready(function(){
        $('#iframe').after('<iframe src="url" scrolling="no" frameborder="0" overflow:hidden; width:400px; height: 70px;"></iframe>');
});
</script>

Upvotes: 1

TommyBs
TommyBs

Reputation: 9646

You don't need that DOCTYPE, only if you want it to validate at W3.org otherwise you should be fine and the OG tags should still work. You can use the url linter to check this:

http://developers.facebook.com/tools/lint/

I've done this many times just using

<!DOCTYPE html>

I would have just added a comment for this to extend on what MicE said but I don't have enough REP yet!

Upvotes: 0

Related Questions