w3c told me Error Line 10, Column 16: there is no attribute ...">

Facebook meta tags screw w3c check

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

w3c told me

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

How can i fix this?

+7
source share
2 answers

You cannot fix this, facebook code is invalid HTML. You cannot make an HTML page that passes validation if you want to use facebook scripts on it.

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

+7
source

There is a temporary solution with PHP that I use to get validation using w3c:

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

Now use this function for the metacode:

 <?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, this is just a workaround and does not make your HTML "really" valid.

+3
source

All Articles