-2

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?

Steeven
  • 4,057
  • 8
  • 38
  • 68
  • @Richard. Well I can't change the attributes or tags for the buttons. I can't figure out what could be done. I recon the only solution is the answer below, which is to hide it from the html by adding it with javascript. – Steeven Jul 07 '12 at 10:49

2 Answers2

4

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.

Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194
  • What privacy issues are there? Is it because thouse buttons might logon to your profile if your logon-data are saved in the browser? – Steeven Jul 07 '12 at 08:54
  • 3
    @Steeven, even non-Facebook users are tracked if your page loads stuff from the Facebook servers. Fetching the Facebook JavaScript [no longer sets a cookie](http://web-sniffer.net/?url=http%3A%2F%2Fconnect.facebook.net%2Fda_DK%2Fall.js&submit=Submit&http=1.1&type=GET&uak=0), but tracking through a very short cache time and [an `ETag`](http://en.wikipedia.org/wiki/HTTP_ETag#Tracking_using_ETags) is probably just as common nowadays. (In this case: I wonder how the `Cache: public` mangles that.) Facebook's US$ 100 billion market value is based on something, right? – Arjan Jul 07 '12 at 10:02
  • (Too late to edit my comment, but: given that `Cache-Control: public` I wonder if Facebook maybe *really* no longer has the option to track by just getting the JavaScript. But then, in the JavaScript, other resources will be loaded, that probably still enable tracking. Same goes for others such as LinkedIn. Of course Google already knows everything...) – Arjan Jul 07 '12 at 10:11
2

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.

Tom Waddington
  • 1,948
  • 15
  • 18