0

When I validate my web page, sometimes the conformance checker will validate the following random code instead of my web page.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"> -->
<HTML>
<HEAD>
<META HTTP-EQUIV="Refresh" CONTENT="0.1">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<TITLE></TITLE>
</HEAD>
<BODY><P></BODY>
</HTML>

When it does this, I can select the "show source" option and re-validate the page until my source shows up, which conforms to html5 just fine.

Why do I get this random code sometimes? I usually wouldn't care, but one of my professors keeps trying to dock my assignments for not conforming. Sadly, he doesn't have any suggestions on how to fix this. Please let me know if there is something I can change in my code to avoid random substitutions in the conformance checker.

I am using the checker at validator.w3.org

The following is a sample of my code:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="/css/default.css" type="text/css" rel="stylesheet" media="screen">
<title>Database Plan</title>
<?php include $_SERVER["DOCUMENT_ROOT"]."/modules/googleanalytics.inc"; ?>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div id="wrapper">

<header id="header">
<div id="redback">
<?php include $_SERVER["DOCUMENT_ROOT"]."/modules/header.inc"; ?>
</div>
</header>

<nav id="navtop">
<div>
<?php include $_SERVER["DOCUMENT_ROOT"]."/modules/topnav.inc"; ?>
</div>
</nav>

<div id="centerbox">

<div id="article">
<article id="innerarticle">
<div>

<p>Article Content</p>
</div>
</article>
</div>
</div>
<footer id="footer">
<div id="grayback">
<?php include $_SERVER["DOCUMENT_ROOT"]."/modules/footer.inc"; ?>
</div>
</footer>
</div>
</body>
</html>
swj
  • 1

2 Answers2

1

is your host siteground? - I have a client having a similar issue and my hypothesis is that the server is setup such that if the page is not available at the time the request is made the server returns this generic HTML page with the meta-refresh on it that is imperceptible to the website visitor but is interpreted by the validator.

Sam
  • 11
  • 2
0

You need to tell it specifically to use the HTML5 validator:

enter image description here

This worked for me when copying and pasting through direct input.

EDIT: There is also this experimental validator as well:

http://html5.validator.nu/

onteria_
  • 68,181
  • 7
  • 71
  • 64
  • Even if I specify html5 on the validator, it will substitute a blank page in randomly. It seems like it's running as 4.0.1 strict because of the substitution that pops in every now and then. – swj May 23 '11 at 19:43
  • How do you perform the validation? Do you point the validator to an online instance of your mark-up, a local file, or direct upload? When I'm coding locally, I tend to use the "Tools" » "Validate Local HTML" menu option in the (Firefox) Web Developer plugin, which works pretty well. – Ben May 23 '11 at 19:51
  • I use the firefox web developer toolbar. I have also gotten the same results from typing the url into sites like html5.validator.nu/ – swj May 23 '11 at 19:57
  • I am validation my pages from a live site. My website is online and I just click the "validate html" option in the web developer toolbar. I then click the "show source" option, and select "validate html5" before clicking the "revalidate option." I only get the error I mentioned earlier 40% of the time. The pages I am validating are at ShayneJensen.com. The specific pages I am trying to validate can be reached from the last two lines of links in the footer. The pages are named things like "add content" "register" and "view all users". – swj May 23 '11 at 20:33