Facebook meta tags screws up w3c validiation
Asked Answered
T

2

7
<meta property="fb:admins" content="10476" />

w3c told me

Error Line 10, Column 16: there is no attribute "property" 

How can I fix it?

Teliospore answered 8/7, 2011 at 7:29 Comment(1)
What exactly does this meta tag do?Olivares
T
7

You can't fix it, the facebook code is not valid HTML. You can't make an HTML page that passes validation if you want to use facebook scripts on it.

Unless, of course, you rewrite all facebook client code that you have on the page into code that uses valid HTML elements.

Tokharian answered 8/7, 2011 at 7:31 Comment(0)
S
3

There is a workaround with PHP I use to get validation by w3c:

function facebook(){
if(!(stristr($_SERVER["HTTP_USER_AGENT"],'facebook') === FALSE))
return true;
}

Now use this function for the meta code:

<?php
if(facebook()){ ?>
    <meta property="fb:admins" content="10476" />
<?php } ?>

Or if you just want W3C to validate your HTML use this function:

function w3c(){
    if((stristr($_SERVER["HTTP_USER_AGENT"],'w3c') === FALSE))
    return true;
}

As I said, it's just a workaround and doesn't make your HTML 'really' valid.

Stammer answered 19/9, 2011 at 8:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.