[Windows 10上的CHM查看器不允许我在JavaScript中使用'window'对象,尽管在Windows 7上它可以与相同版本的Internet Explorer完美配合。
要重现此问题:将此代码复制到文件'index.htm'
<!DOCTYPE html>
<html>
<body>
<script>
document.write("Inner width: " + window.innerWidth + "<br>");
try
{
window.addEventListener('scroll', function(e)
{
document.write("Scroll<br>");
} );
document.write("All right.<br>");
}
catch (ex)
{
document.write("Exception: " + ex.message + "<br>");
}
</script>
</body>
</html>
然后将此代码复制到文件'Test.hhp'
[OPTIONS]
Binary Index=No
Compatibility=1.0
Compiled file=Test.chm
Default Window=>MainHelp
Default topic=index.htm
Display compile progress=Yes
Language=0x409 Englisch (USA)
Title=Testing
[WINDOWS]
>MainHelp="Testing",,,"index.htm",,,,,,0x40000,,0x0,[50,50,900,750],,,,,,,0
将两个文件都复制到同一目录中,并通过HTML帮助工作室进行编译。
在Windows 7上可以正常使用:
在Windows 10上,它可以在Internet Explorer中使用,但不能在CHM文件中:
[Windows 10中似乎有安全限制,而Windows 7中没有。
是否有任何注册表项或Internet Explorer设置可以修改以赋予CHM查看器访问“窗口”对象的权限?