The CHM viewer on Windows 10 does not allow me to use the 'window' object in JavaScript, although on Windows 7 it works perfectly with the same version of Internet Explorer.
To reproduce this problem: Copy this code into a file '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>
Then copy this code into a file '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
Copy both files into the same directory and compile them with the Html Help Workshop.
On Windows 7 it works as expected:
On Windows 10 it works in Internet Explorer, but not in the CHM file:
There seems to be a security restriction in Windows 10 which is not in Windows 7.
Is there any registry key or any Internet Explorer setting which I can modify to give the CHM viewer the permission to access the 'window' object ?
Edit: After reading the answer from Dai I found why it worked on Windows 7 and not on Windows 10. It has nothing to do with the Windows version. The reason is that on my Windows 7 another software already had set the registry key
[HKLM\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION]
hh.exe = 9000