W3C Markup Validation error

I am working on a test site, http://www.wiegand.org/test7.php, there is a link in the footer to the validator, that is html/php/mysql with a few includes of course. When validating to HTML5 I get this error -

Error

Sorry, I am unable to validate this document because on line 14 it contained one or more bytes that I cannot interpret as us-ascii (in other words, the bytes found are not valid values in the specified Character Encoding). Please check both the content of the file and the character encoding indication.

The error was: ascii "\xA9" does not map to Unicode

I cannot find anything wrong, let alone figure out exactly which line 14 it is referring to, it could be in any number of included files. but I can’t find any errors like it indicates.

Well, this is like the other post about DOCTYPES.

On your page you are using a “LOOSE” doctype.
Therefore, some special characters may not be allowed.

It might be the copyright symbol. It should be okay, but, try it without it or another doctype.

Here is a link explaining the DOCTYPES. Not sure if it helps.

But, I also noticed that your DOCTYPE line does not include the actual doctype file.
When it is not added, it takes a default one. I have noted that this sometimes can cause odd problems.
Here is my “LOOSE” version with the file link in place. Try it too and see if it fixes it…

[php]

[/php]

http://www.w3.org/wiki/Doctypes_and_markup_styles

Let us know if you solve it. I am curious…

Using the doctype you provided made no difference. I also removed the copyright symbol, again, no difference. I found a post in another forum about the same issue and that had a similar response, to remove the copyright symbol, but for that OP it also did not solve his problem, and there is no post in that forum saying how it was resolved. Oh well. I will keep playing with the code in the hope of finding the problem.

Well, I may have found the solution. It seems that you can NOT enter the copyright symbol as a copyright symbol…
You actually have to use the HTML version of it.

This is &copy !!!

So, try replacing the manually entered copyright with the HTML version and the browser should convert it to match the doctype and charset you are using.

Let me know if that fixes it up… Or, I mean, let us ALL know… Hope that is it…

Yes, that solved that problem. Now though the validator has revealed a few more - 12, eight of which are related to google ads scripts. Is there a fix for those or do I just have to settle for invalid code because of them?

For the Google Ads, where you have async="", remove the =""… It is just async.

At least that is what I think is correct. Let us know…

The google script code is already correct in that regards, so here are the errors as listed by the validator -

This script -

<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- first --> <ins class="adsbygoogle" style="display:inline-block;width:120px;height:600px" data-ad-client="ca-pub-1823930734785601" data-ad-slot="4228312577"> </ins> <script>(adsbygoogle = window.adsbygoogle || []).push({});</script>

results in these errors -

 there is no attribute "ASYNC"
	<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js…

 required attribute "TYPE" not specified
…agead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- first -->

 there is no attribute "DATA-AD-CLIENT"
…th:120px;height:600px" data-ad-client="ca-pub-1823930734785601" data-ad-slot="…

there is no attribute "DATA-AD-SLOT"
…ight:600px" data-ad-client="ca-pub-1823930734785601" data-ad-slot="4228312577">

required attribute "TYPE" not specified
	<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>

and this script -


	<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><!-- third -->
	<ins class="adsbygoogle" style="display:inline-block;width:120px;height:600px" data-ad-client="ca-pub-1823930734785601" data-ad-slot="1317251778"></ins>
	<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>	

results in these errors -

[code]
“ASYNC” is not a member of a group specified for any attribute

required attribute “TYPE” not specified
[/code]

I guess, correct me if I am wrong, I can simply add type="" to each to clear that message and remove the async="" to clear that message? Or will that break the scripts?

Well, I said, there is NO async="" That would make it an argument. “async” is an option.
It should mean that the works both ways. Just remove the ="" after it and retry it.

I bet that will fix a lot of the errors. If not I will look at it again…

Here is a link… Look near the bottom at the SYNTAX … NO =""

Hope this helps… http://www.w3schools.com/tags/att_script_async.asp

The errors have been reduced to just 3 different errors in one script and 1 error in the second script.

This is interesting - script 1 has these errors -
“ASYNC” is not a member of a group specified for any attribute (for both scripts)
there is no attribute “DATA-AD-CLIENT” (in both scripts but errors only in script 1)
there is no attribute “DATA-AD-SLOT” (in both scripts but errors only in script 1)

And in script 2 the only error is -
“ASYNC” is not a member of a group specified for any attribute

I find this interesting because the two scripts are identical except for the data for the attribute data-ad-slot. The validator claims that it is not a vaild attribute in script 1, but apparently it’s valid for script 2.
In the two scripts they have slightly different data assigned in that attribute.

The validator claims that data-ad-client is not valid in script 1 but apparently it’s valid for script 2.
In the two scripts these attributes are identical.

I cleared the other errors by adding in type=“text/javascript” to the sections.

Well, per Google’s site, this is a sample of the script needed:
[php]



[/php]
So, as you see, there is NO “type” argument in it.
Your version is like this:
[php]

<ins class="adsbygoogle" style="display:inline-block;width:120px;height:600px" data-ad-client="ca-pub-1823930734785601" data-ad-slot="1317251778"></ins>
<script language="JavaScript" type="text/javascript">(adsbygoogle = window.adsbygoogle || []).push({});</script>

[/php]
So yours is quite different than their sample. Not sure what to say. I do not really use these ads.
Here is where I read this: https://support.google.com/adsense/answer/3221666?hl=en
Hope that helps you somehow…

Thanks for the info. comparing the two -
my version of the script -

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" type=""></script> <ins class="adsbygoogle" style="display:inline-block;width:120px;height:600px" data-ad-client="ca-pub-1823930734785601" data-ad-slot="4228312577"></ins> <script language="JavaScript" type="text/javascript">(adsbygoogle = window.adsbygoogle || []).push({});</script>
google version of the script -

<script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:inline-block;width:300px;height:250px" data-ad-client="ca-pub-xxxxxxxxxxxxxxxx" data-ad-slot="6440411535"></ins> <script>(adsbygoogle = window.adsbygoogle || []).push({});</script>

As you can see the differences are minor. I added the type attribute and that relevant error went away. Of the two scripts I have in my site only script 1 causes errors. Script 2 is identical to script one except for the data for attribute data-ad-slot.

Why #1 gets errors and #2 doesn’t is a mystery.

Script #2 for comparison purposes -

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" type=""></script> <ins class="adsbygoogle" style="display:inline-block;width:120px;height:600px" data-ad-client="ca-pub-1823930734785601" data-ad-slot="1317251778"></ins> <script language="JavaScript" type="text/javascript">(adsbygoogle = window.adsbygoogle || []).push({});</script>

Oh, and in the link you provided to the W3C about the async - this is from that page -
"
In XHTML, attribute minimization is forbidden, and the async attribute must be defined as .
"
so even though they say it must be defined that way it works without the =“async” part.

Well, again, theirs do NOT have the TYPE= in it.

So, yours is totally different because the selects the default “TYPE” of the script and that is NOT a google-ad type.

Try it without the TYPE="" in it…

Without the type="" attribute the validator throws up errors -

required attribute “TYPE” not specified

<script language="JavaScript">(adsbygoogle = window.adsbygoogle || []).push({}…

two errors for each of the scripts.

You do not need it on the first one.

The one with “PUSH” in it is javascript. So, it has to have the type=javascript.

Yikes, this is tricky…

Well, just to make sure nothing in the code was mess up on my side I went back to my adsense account and grabbed the original code, and am back to the original 8 errors for the two ads.

These are from the W3C -

 Error Line 104, Column 15: "ASYNC" is not a member of a group specified for any attribute

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></…

✉
Error Line 104, Column 77: required attribute "TYPE" not specified

… async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

✉

The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.

Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.
Error Line 108, Column 21: there is no attribute "DATA-AD-CLIENT"

     data-ad-client="ca-pub-1823930734785601"

✉

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.
Error Line 109, Column 19: there is no attribute "DATA-AD-SLOT"

     data-ad-slot="4228312577"></ins>

✉

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.
Error Line 110, Column 8: required attribute "TYPE" not specified

<script>

✉

The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.

Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.
Error Line 130, Column 15: "ASYNC" is not a member of a group specified for any attribute

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></…

✉
Error Line 130, Column 77: required attribute "TYPE" not specified

… async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

✉

The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.

Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.

Hmmm, lots of reading…

Try it this way…

[php]

[/php]

This was from Google’s site. A sample with your numbers in it. A couple small changes.
Not sure if it will work, but, try it and let me know…

Also, Google is set up to help you with this.

You have to open an error report…

I think the link is: https://productforums.google.com/forum/#!newtopic/adsense

You can plug in your code and give them your test address and they will help you going by what I read.

But, I think this last version might work as it came from Google’s forum… Let me know…

Hi, thanks for the code, but no change at all in the error messages. I will post a message on the adsense forum also. I also found that just a while ago.

Well, I posted a message on the google forum, the did a search and found a post by a person with the same problem. He posted his code which did pass validation. He used an older version of the script and plugged in the new …pub and …slot numbers and it works. I did that, and no more errors. Now to verify that the ads change as expected.

Here is the code used -

[code]

[/code]
Sponsor our Newsletter | Privacy Policy | Terms of Service