Question

When you add social media buttons to your site from Google+, Facebook, LinkedIn etc., they often contain a lot of homemade attributes and other things that don't validate.

I have fourteen errors on this page in the validator just because of social buttons.

Are there any tricks to make the page validate?

Was it helpful?

Solution

As the buttons will only work for users with Javascript, the simplest thing you could do is to insert them via javascript. Then your page will validate again.

Beware of the privacy issues of "social spying buttons". It is a good pracitise to not automatically load them, but just show a placeholder image, and load the actual button when the user has clicked it. These are the so called "2 click likes". First click to enable transmitting your data to Facebook, the second click to like.

OTHER TIPS

An incorrect HTML version causes most of the errors - the social buttons are using data- attributes, part of HTML5, but the page has been validated as HTML4.

Sorting the doctype should fix a bunch of those errors.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top