Interesting Page Refresh Problem Goes Uncaught at validator.w3.org

In every edition of our book since the World Wide Web Consortium (aka W3C, with website at w3.org) put up its validator in the late 1990s we recommend that our readers use this tool to make sure their files are working properly as part of the debugging and publication process. (My old buddy and co-author on various CGI and other books, Mark Gaither, actually built the first known HTML validator in 1992-1993, using SGML technology to help him get a leg up, so I’ve been a believer since I first learned HTML, having learned the value of syntax checking when writing code using honest-to-gosh programming languages like C, SmallTalk, Pascal, and other stuff nobody uses an more.)


Last week, we heard from a couple of readers (Thanks, Lisa and Robert! Thanks a whole bunch!!!) who told us that the redirect on the original landing page for the 6th edition of our book (www.edtittel.com/html4d6e/) was going into an infinite loop when they tried to use it to get to the latest version of those pages right here on this very site (www.dummieshtml.com/archives/html4d6e/). Try as Jeff Noble, Rebekkah Hilgraves (the Webmaster and site operator for my edtittel.com site), and I might, we couldn’t replicate the problem. I even went so far as to validate this very short redirect Web page on that site to try to find the error:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="refresh" content="1;http://www.dummieshtml.com/archives/html4d6e/" />
<title>HTML, XHTML, and CSS For Dummies, 6th edition</title>
</head>
<body>
</body>
</html>

The validator passes this page as it stands but it does contain one crucial error that caused the page to load, then re-load, in an infinite loop in some Web browsers (IE 6 and the AOL browser of about the same vintage reacted as described, but other older browsers would very likely have displayed the same behavior). If you run the preceding text through the W3C Validator you’ll get a “Passed” status, but with a warning that says the utf-8 encoding is implied but not explicitly stated. Careful examination of the code shows that this analysis is in fact incorrect because the content-type meta tag correctly describes the character encoding as UTF-8.

The output says "Passed," but also dispenses a cryptic warning

It was only after multiple re-readings, and extremely careful analysis, that we realized some data was missing in the Meta element that handles the redirect (duh! redirect problem = markup issue; we should known!!). It turns out that the proper syntax for this particular markup element is actually as follows:


<meta http-equiv="refresh"
content="1;url=http://www.dummieshtml.com/archives/html4d6e/" />

That is, we omitted the “url=” before the actual URL string for the redirect target in that statement. But the validator didn’t catch or flag that error, so it sailed through our quality control process. Why did this happen? Because many modern browswers (we couldn’t replicate this problem using currrent versions of IE 8 or 9, Chrome, Firefox, Opera, or Safari) automatically recognize the error and perform the proper handling anyway.

Very interesting! This goes to show that no tools are perfect, and that not even the best of testing and debugging procedures can catch every single tiny little mistake that can creep into markup. This is why learning HTML is a good idea, and why you can’t rely completely on tools to handle everything for you. Heed our mistake as you test your pages and sites, and remember to give the Meta element markup a careful once-over with your very own eyeballs, because the W3C Validator won’t catch all the errors in its attribute values (the stuff inside the quotation marks) for you.

You’ve been warned!

Leave a Reply

Your email address will not be published. Required fields are marked *