AndyZa写道:AndyZa wrote:根据w3c规范,如果缺少DOCTYPE 声明,则网页无效。因此,如果我将以下doctype添加到我的页面中它们将是合规的: <!DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.01 // EN" " http://www.w3.org/TR/html4/strict.dtd"> 但这与用户可能没有的INTRANET网站相关/> INTERNET访问?页面如何通过 http://进行验证www.w3.org/TR/html4/strict.dtd DTD如果用户没有上网?如果浏览器无法连接到 www.w3.org ,会发生什么情况存储.dtd文档的站点? 验证是否失败? According to the w3c specs a web page is not valid if the DOCTYPE declaration is missing. So, if I add the following doctype to my pages they will be "compliant": <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> But is this relevant to INTRANET sites where users might not have INTERNET access? How does the page get validated against the http://www.w3.org/TR/html4/strict.dtd DTD if the users don''t have internet access? What happens if the browser is unable to connect to the www.w3.org site where the .dtd document is stored? Does the validation "fail"? HTML / XHTML中的DOCTYPE是一个不透明的字符串,用于匹配使用过的标签和 内部数据构建到浏览器中的属性(考虑名称空间 XML格式的声明)。没有人浏览器/检索/链接的DTD,因为它不应该在HTML页面中以这种方式使用.b $ b。还有一些浏览器 (比如说Firefox)根本无法检索外部DTD,即使他们出于某种原因需要 。 所有UA都能够通过完整形式 (带URL)或短格式(不带URL)匹配这些不透明字符串。所以不要混淆你的11个 与你可能只使用的伪URL问题<!DOCTYPE HTML PUBLIC " - // W3C // DTD HTML 4.01 // EN" ;> 这是完全正确的,字符串仍然正常 匹配。DOCTYPE in HTML/XHTML is an opaque string used to match used tags andattributes against internal data build into browser (think of namespacedeclarations in XML). No one browser /retrieve/ the linked DTD as it''snot supposed to be used in such way in HTML pages. Also some browsers(say Firefox) simply not capable to retrieve external DTD''s even ifthey wanted to for some reason.All UA''s are capable to match these opaque strings either by full form(with URL) or by short form (without URL). So do not confuse yourselvewith pseudo-URL issues you may just use <!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.01//EN">That is perfectly correct and the string will be still properlymatched.>>如何根据>> How does the page get validated against the http://www.w3.org/TR/html4/strict.dtd DTD如果用户没有上网功能?它不是。除非您在Intranet上安装了验证器,例如如果您要在发布过程中验证您的页面。 http://www.w3.org/TR/html4/strict.dtd DTD if the users don''t have internet access? It doesn''t. Unless you have a validator installed on the Intranet e.g. if you are be validating your pages as part of the publication process. Web浏览器是否忽略" doctype标签的url部分?Does the web browser "ignore" the url part of the doctype tag?或者我应该完全忽略内部网页面的doctype声明吗? Or should I leave out the doctype declaration completely for intranet pages? 您希望您的页面符合规格吗? Do you want your pages to be compliant with the specs or not? 是的!这就是我想要的全部! 也许更重要的是你想触发Quirks或Standards Compliant渲染模式?这就是网页浏览器使用doctype 声明的所有内容。YES! That''s ALL I want! Perhaps more importantly do you want to trigger the Quirks or Standards Compliant rendering mode? That''s all that web browsers use the doctype declaration for. Aaah! 所以,浏览器使用doctype声明所做的一切就是用它来实现Quake和标准兼容模式之间的切换?这就是为什么 是否有必要在页面中包含doctype声明?那是 吗? 如果我使用验证器,它会使用在w3.org网址上找到的.dtd 进行验证的声明? 这是doctype标签中w3.org url的唯一目的吗? 是, 我知道!我糊涂了!点火......!Aaah!So, all that the browser does with the doctype declaration is use it toswitch between the Quirks and Standards Compliant mode? And that''s whyit''s necessary to include the doctype declaration in the page? Is thatit?And if I use a validator it uses the .dtd found at the w3.org url inthe declaration to do that validation?Is that that the only purpose for the w3.org url in the doctype tag?Yes, I know! I''m confused! Flame on...! 这篇关于Intranet站点上的DOCTYPE声明。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
05-27 23:14
查看更多