Search This Blog

Saturday, 7 November 2009

The Quest for XHTML Perfection

This afternoon I remembered the existence of the W3C Markup Validation Service, http://validator.w3.org/, and decided to submit the web sites I maintain. As usual I was appalled by the number of omissions, typing errors, and plain mistakes that your average browser will quite happily work round without telling you. Unterminated paragraph blocks, lists inside blocks, attribute values with a quote at one end but not the other, to name just three blunders which now no longer afflict my HTML.

The ideal is to press the Validate button and get back the message, "This document was successfully checked as XHTML 1.0 Strict!" Once you've got that, you're allowed to put a W3C badge on the page to tell the world how compliant you are, or at least the 0.1% or less of the world who've ever even heard of the W3C, or XHTML. Rather than confuse the other 99.9% of the world, I have decided not to use this badge. Also, I would then live in fear of inadvertently invalidating the page through some stupid edit, and incurring the wrath of the W3C.

Another reason for not boasting of my pages' compliance is that not all of them are, and there doesn't seem to be much I can do about it. At one of my sites, gratuitous link to encourage Google to notice it, I include a link to a specific page at the UK Charity Commission's web site. Even though I'm quoting their URL exactly, the W3C is flagging up errors in the URL and blaming me. This seems a mite pedantic of them. Am I supposed to tidy up someone else's web site?

The link in question is http://www.charity-commission.gov.uk/ShowCharity/RegisterOfCharities/CharityWithoutPartB.aspx?RegisteredCharityNumber=1119272&SubsidiaryNumber=0, and the presence of the ampersand near the end causes W3C to kick out four errors and three warnings. And now, by putting that link into this blog, I've managed to make this page non-compliant too!

Footnote: thinking about my question above, I wondered if I could tidy up the URL. Turns out I can leave the part from the ampersand onwards! I got lucky there, but I think my point still stands.

Now my only non-compliance is the use of the 'target' attribute in hrefs. Need to do a bit of research about why that's not valid XHTML.