Hi,
I found out that Google +1 buttons don't pass the w3c validator test.
I get a great amount of errors.

Do you have a solution to solve it? Maybe use google code inside javascript?

Help please.

Comments

jscm’s picture

Title: W3c Validator and Google +1 button code » W3C Validator and Google +1 button code: too much errors
Category: feature » bug
corbacho’s picture

Status: Active » Closed (works as designed)

If you choose the HTML5 syntax, it should pass the W3C HTML5 validator.
About the XHTML... no. It's sad yes. But I've to say that most if not all of the social widgets are not very respectful with the W3C standards.
In any case, it's something I can't solve. This module is a mere "glue", it's Google business.

Read more in Google Webmasters forum (search about w3c) http://www.google.com/support/webmasters/bin/search.py?hl=en&forum=1&que...

jscm’s picture

if you use g+ code inside javascript, do you think it could be work?

I read that using fb like button inside javascript the w3c validator check it with success.

corbacho’s picture

I googled about it and maybe wrapping the button tag inside ![CDATA[ ]] tags could make the trick.
I don't promise anything.. but I will test and try to do it this week.
If you know theming.. you can do it yourself, overriding the theme function of the module and give me feedback?

jscm’s picture

I don't know how theming using drupal "hooks" ... I could try inserting g+ code with javascript inside theme.

jscm’s picture

I found out this:

<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<div class="g-plusone" data-size="medium" data-count="true">

But the tag data-lang or simply lang don't pass w3c validator check

jscm’s picture

rupamguha’s picture

for w3c validation for google+, facebook api or twitter plugin you can user javascript document.write covered by xml CDATA.

please find the following link for more details script,
http://www.newtechtips.org/tips-and-tricks-to-validate-w3c-for-facebook-...

corbacho’s picture

I want to remind that is W3C-HTML5 valid (choosing the setting in the admin options).
But it's not XHTML valid.

Related:
http://stackoverflow.com/questions/6217434/google-1-button-not-w3c-compl...

And I'm not willing to put hacks using "document.write", also because this function is considered bad practice and can give collateral problems.

Google has decided to make it non XHTML-valid. Accept it and explain it to your customers.
The duty of this module is to serve it as it is.

Notice also that the rendering of the button format is inside a theme_ function. So you can override in your theme template.php if you want.