简体   繁体   English

html5 一致性检查器替换了我的文档类型

[英]html5 conformance checker replaces my doctype

When I validate my web page, sometimes the conformance checker will validate the following random code instead of my web page.当我验证我的 web 页面时,有时一致性检查器会验证以下随机代码,而不是我的 web 页面。

<!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.当它这样做时,我可以 select 的“显示源”选项并重新验证页面,直到我的源出现,这符合 html5 就好了。

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我在 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>

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. - 我有一个有类似问题的客户端,我的假设是服务器的设置是这样的给网站访问者,但由验证器解释。

You need to tell it specifically to use the HTML5 validator:您需要专门告诉它使用 HTML5 验证器:

在此处输入图像描述

This worked for me when copying and pasting through direct input.通过直接输入复制和粘贴时,这对我有用。

EDIT : There is also this experimental validator as well:编辑:还有这个实验验证器:

http://html5.validator.nu/ http://html5.validator.nu/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM