Opening a CHM file produces: “navigation to the webpage was canceled”

前端 未结 9 1095
有刺的猬
有刺的猬 2020-12-04 16:26

I am trying to open a .chm file.

I downloaded the source, extracted it, and double clicked on Waffle.chm and clicked \"Open\" but no matter what element

相关标签:
9条回答
  • 2020-12-04 16:52

    There are apparently different levels of authentication. Most articles I read tell you to set the MaxAllowedZone to '1' which means that local machine zone and intranet zone are allowed but '4' allows access for 'all' zones.

    For more info, read this article: https://support.microsoft.com/en-us/kb/892675

    This is how my registry looks (I wasn't sure it would work with the wild cards but it seems to work for me):

    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp]
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x]
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]
    "MaxAllowedZone"=dword:00000004
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]
    "UrlAllowList"="\\\\<network_path_root>;\\\\<network_path_root>\*;\\ies-inc.local;http://www.*;http://*;https://www.*;https://*;"
    

    As an additional note, weirdly the "UrlAllowList" key was required to make this work on another PC but not my test one. It's probably not required at all but when I added it, it fixed the problem. The user may have not closed the original file or something like that. So just a consideration. I suggest try the least and test it, then add if needed. Once you confirm, you can deploy if needed. Good Luck!

    Edit: P.S. Another method that worked was mapping the path to the network locally by using mklink /d (symbolic linking in Windows 7 or newer) but mapping a network drive letter (Z: for testing) did not work. Just food for thought and I did not have to 'Unblock' any files. Also the accepted 'Solution' did not resolve the issue for me.

    0 讨论(0)
  • 2020-12-04 16:54

    "unblocking" the file fixes the problem. Screenshot:

    enter image description here

    0 讨论(0)
  • 2020-12-04 17:07

    In addition to Eric Leschinski's answer, and because this is stackoverflow, a programmatical solution:

    Windows uses hidden file forks to mark content as "downloaded". Truncating these unblocks the file. The name of the stream used for CHM's is "Zone.Identifier". One can access streams by appending :streamname when opening the file. (keep backups the first time, in case your RTL messes that up!)

    In Delphi it would look like this:

    var f : file;
    begin
     writeln('unblocking ',s);
     assignfile(f,'some.chm:Zone.Identifier');
     rewrite(f,1);
     truncate(f);
     closefile(f);
    end;
    

    I'm told that on non forked filesystems (like FAT32) there are hidden files, but I haven't gotten to the bottom of that yet.

    P.s. Delphi's DeleteFile() should also recognize forks.

    0 讨论(0)
  • The definitive solution is to allow the InfoTech protocol to work in the intranet zone.

    Add the following value to the registry and the problem should be solved:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]
    "MaxAllowedZone"=dword:00000001
    

    More info here: http://support.microsoft.com/kb/896054

    0 讨论(0)
  • 2020-12-04 17:12

    Go to Start

    Type regsvr32 hhctrl.ocx

    You should get a success message like:

    " DllRegisterServer in hhctrl.ocx succeeded "

    Now try to open your CHM file again.

    0 讨论(0)
  • 2020-12-04 17:12

    other way is to use different third party software. This link shows more third party software to view chm files...

    I tried with SumatraPDF and it work fine.

    0 讨论(0)
提交回复
热议问题