Navigation

Search

Categories

 
 
 
 
 
 
 
 
 

On this page

Make the noscript tag xhtml valid

Archive

Blogroll

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 8
This Year: 0
This Month: 0
This Week: 0
Comments: 5

Sign In
Pick a theme:

# Wednesday, 10 January 2007
Wednesday, 10 January 2007 13:45:03 (GMT Standard Time, UTC+00:00) ( Html | W3C | Xhtml )

For many statistics and tracking applications all over the internet you need to implement a code snippet containing a noscript tag with a hidden image to make the logging still work if scripting is disabled.  This is done with the <noscript> tag.

But...

In Xhtml 1.0 Strict the noscript tag is invalid for the validator if inside a HTML block element (<p>,<th>,<td>,...).  As a followup to the previous post to make .NET applications Xhtml valid this one is a small addon, but it doesn't require .net, only HTML.

To make a <noscript>...</noscript> tag valid for the w3c validator you should replace it with <object><noscript><div>...</div></noscript></object>.
This weird followup of tags makes it possible to make the page validate.  The object tag makes the use of the <noscript> tag possible in other tags like the <p> tag.
As for most statistics scripts you need to implement, the <noscript> tag contains one single <img ..../> tag.  That would generate another error in the validator because there is no <img/> tag allowed inside a <noscript> tag.  Therefore the div is placed inside the <noscript> tag to make even that little invisible image validate.

Wonderful that this works, it made my search worth the while.

Source: phpCMS Wiki