Coding for Web Standards
Áine on May 26th, 2004 filed in Pixel PixiesI have to preface this entry by saying that not every page of this domain meets the W3C Web Standards, although little by little, I’m working on making the pages comply. Recently I’ve engaged in some email conversation with Debbie from the Amazon.com Associates Program regarding Amazon’s auto-generated ad code and how it just doesn’t validate as outputted. In fact, not only doesn’t it validate, some of the code spits out javascript as text right on not only their demonstration page, but also whatever page you insert their code into! The main culprit seems to be the javascript which Amazon uses to generate Keyword Links Ad Boxes when you try to customize the colors. Google has a similar problem meeting Web Standards with the Search boxes it’s site generates for webmasters, and I’ll talk about that further down in the extended portion of this entry.
images/error_in_script.gif” width=”140″ height=”301″ border=”0″ />Amazon’s response, so far, has been less than stellar; first blaming it on the difficulty of writing Standards-compliant code, then blaming it on the validator’s limitations, then blaming it on some error generated on MY END (Debbie apparently can’t see the problem I’ve described to her in detail, even after I gave her step-by-step instructions on how to replicate what I’m seeing). I’ve tested their ad-generating code in both IE and Mozilla, and I can clearly see the problem in BOTH browsers (see the graphic at left), so if my computer is somehow generating this error, it’s doing it in two different browsers and I don’t see how that’s possible. If it were my computer generating this error, I would think I would see this problem in every type of javascript I’ve ever used, and I don’t see it except with Amazon’s code. I’ve also posted in their Associate’s forums, and I’m hoping someone over there will take notice and figure out what exactly is causing this problem. With regard to Web Standards, Amazon has made no effort in writing Standards-compliant code for it’s Associate’s program, as far as I can tell, so if you use their code as-is, your pages containing Amazon code will not pass the Validators at W3C. I’ve spent literally HOURS tweaking their code so that it will be compliant, but I (and presumably hundreds or thousands of other webmasters) wouldn’t have to do this if they would spend the time to make their scripts output valid code. I don’t think this is an impossible task. After all, they have one of the largest, most complex databases on the planet, right? I’m just a self-taught web designer, and if I can do it, so can they. I’ve also noticed that after doing my code tweaks to make their code compliant, the code I’m writing is actually much shorter and more efficient than what I started with.
Now, as for Google… I wanted a customized Google search for my entire domain, and after going through all the creation process at Google to get one, I found that their code also failed to validate. Much of the problem (both at Google and at Amazon) seems to stem from form and styling elements being marked wrong for xhtml validation. If you are at all familiar with Web Standards, this is not that difficult to fix their code. One sticky problem I was having, however, had to do with radio buttons and indicating that a button was supposed to, in it’s initial state, be “checked.” Now, part of the blame for this problem is that even in W3C’s documentation, NOWHERE in there could I find how to specify that a radio button was initially supposed to be checked, nor were there any references on how to write the code to specify this. All it said was that “checked” was an attribute of “radio,” not how to make it so. I pulled my hair out over this one for the last week or so. I searched high and low for any references whatsoever to the attribute and I found nothing. The code supplied by Google would not pass the validator even after I had tweaked it just because of this one attribute. It was driving me insane. Finally, in desperation, I coded: checked=”checked” hit SAVE, uploaded the changed code, punched the validator button, and voila! it validated!! I about fell off my chair laughing at the simplicity of it all. Why doesn’t anyone tell us such simple things? Why isn’t it mentioned anywhere on the HTML 4.01 Quick Reference from W3C? Why couldn’t I find it anywhere on the W3C website? Hell, I dunno, but I am so happy I figured it out on my own.
Technorati Tags: Pixel Pixies












May 26th, 2004 at 11:40 pm
Heh that’s what I felt when I first threw my blog into the validator an obscene number of errors. Manged to correct them all quite quickly, though only xHTML 1.0 T if I try to go strict or xhtml1.1 I get all these weird errors I don’t understand !
May 26th, 2004 at 11:58 pm
It would be helpful if the xhtml validator would link each error to the references so that we could figure out how to correct the problems, but no, W3C doesn’t do this. I can’t even count the number of hours I’ve spent searching the references for clues. It’s no wonder that amazon and google and many other sites don’t bother writing Standards-compliant code… still, once we get used to writing code this way, it will make our tasks much easier in the future. I feel sorry for those who are currently ignoring web standards because they are locking themselves into having to buy the next version of Windows in order to get the next version of IE. And Mac users will NOT have another version of IE (it’s been discontinued). Those who rely on IE when designing their sites are going to be left behind and are going to lose site visitors in the future.
June 24th, 2005 at 2:22 pm
I also had a problem getting a radio button tag to validate. Try including a formal name attribute in your form tag. If you do so, it should validate by just saying “checked” instead of having to write out checked=”checked”. At least it worked for me.