【发布时间】:2021-10-19 20:31:54
【问题描述】:
在采用默认设置的全新构建的最新 Windows 10 计算机上,我得到以下结果:
HTA #1 输出:“5”
<script>
alert(document.documentMode)
</script>
HTA #2 输出:“7”
<!DOCTYPE html>
<script>
alert(document.documentMode)
</script>
HTA #3 输出:“9”
<head>
<meta http-equiv="X-UA-Compatible" content="IE=9">
</head>
<script>
alert(document.documentMode)
</script>
但是,我有一份来自 Windows 10 计算机上的人的报告,正如预期的那样,HTA #1 显示“5”,HTA #3 显示“9”,HTA #2 也显示“9”。什么设置会导致观察到的行为?
注意:这个问题与另一个类似问题不同,部分原因是它针对 HTA 行为(与 Internet Explorer 应用程序相反),部分原因是另一个问题不清楚带有或不带有 doctype 的文档之间的结果是否不同声明。
【问题讨论】:
-
什么版本的Windows 10,已经有不少了?
-
可以在我的 Windows 10 (21H1) OS Build: 19043.1151 上确认它产生 5、7 和 9。据记录,我的 Windows 10 安装远非默认。
-
另外,Ref - "注意 从 Internet Explorer 10 开始,怪癖模式的行为与早期版本的浏览器不同。在 Windows Internet Explorer 9 及更早版本中,quirks 模式将网页限制为 Microsoft Internet Explorer 5.5 支持的功能。在 Internet Explorer 10 中,quirks 模式符合 HTML5 规范中指定的差异。有关详细信息,请参阅指定旧文档模式)。”