mac
mac

Reputation: 162

How to make Google+ JavaScript tag pass W3C validiation

I've got Google+ button on my site. It works fine, but W3C validator shows error:

The text content of element script was not in the required format: Expected space, tab, newline, or slash but found < instead.

Here is the code:

<script src="https://apis.google.com/js/platform.js" async defer>lang:"pl";</script>

How can I fix this?

Upvotes: 0

Views: 320

Answers (1)

Salman Arshad
Salman Arshad

Reputation: 272106

The W3C validator is complaining about the contents of <script src...> tag. According to these specs, a script tag with src attribute can only contain whitespace and/or JavaScript comments.

You can use the following syntax instead:

<script>
    window.___gcfg = { lang: "pl" };
</script>
<script src="https://apis.google.com/js/platform.js" async defer></script>

Upvotes: 4

Related Questions