Is it possible to pass w3 xhtml strict validation and still use google analytic code on my webpage?

link|improve this question
What errors do you get when you insert google analytics on your page? – Justin Dearing Oct 14 '10 at 11:48
1  
You will probably get better answers at webmasters.stackexchange.com. This site is about using existing web apps, not managing your own web site. – Al Everett Oct 14 '10 at 15:17
feedback

closed as off topic by Barry Dec 2 '11 at 8:36

Questions on Web Applications - Stack Exchange are expected to generally relate to web applications, within the scope defined in the faq.

2 Answers

up vote 0 down vote accepted

Yes, w3 xhtml strict validation does not check or see Javascript.

link|improve this answer
1  
Presumably the <script> tags will need to be valid XHTML. – Al Everett Oct 14 '10 at 15:15
feedback

The <script> tag in XHTML differs slightly from the one in HTML in that its content is of type (#PCDATA), which means that entities in the tag will be parsed. Thus most non-trivial code will break XHTML validation.

To make your <script> tag valid XHTML, use syntax like this:

<script type="text/javascript">//<![CDATA[
var i=10;
if (i<5) {
    // some code
}
//]]></script>
link|improve this answer
feedback