html5一致性检查器取代了我的doctype

时间:2011-05-23 18:50:34

标签: html5 doctype standards-compliance

当我验证我的网页时,有时一致性检查器将验证以下随机代码而不是我的网页。

<!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>

当它执行此操作时,我可以选择“显示源”选项并重新验证页面,直到我的源显示,这符合html5就好了。

为什么我有时会得到这个随机码?我通常不在乎,但我的一位教授一直试图将我的作业停靠在不合规的地方。可悲的是,他对如何解决这个问题没有任何建议。如果我的代码中有些内容可以更改,请告知我们,以避免在一致性检查器中进行随机替换。

我在validator.w3.org上使用检查器

以下是我的代码示例:

<!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>

2 个答案:

答案 0 :(得分:1)

是您的主机站点地址? - 我有一个客户端有类似的问题,我的假设是服务器设置为如果在请求发出时页面不可用,服务器返回此通用HTML页面,其上有元刷新,这是不可察觉的到网站访问者,但由验证者解释。

答案 1 :(得分:0)

您需要具体告诉它使用HTML5验证器:

enter image description here

通过直接输入复制和粘贴时,这对我有用。

编辑 :还有这个实验验证器:

http://html5.validator.nu/