windows 打开 CHM 文件会产生:“网页导航被取消”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11438634/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Opening a CHM file produces: "navigation to the webpage was canceled"
提问by Eric Leschinski
I am trying to open a .chm file.
我正在尝试打开一个 .chm 文件。
I downloaded the source, extracted it, and double clicked on Waffle.chm
and clicked "Open" but no matter what element in the chm file I click, I get the message:
我下载了源代码,将其解压缩,然后双击Waffle.chm
并单击“打开”,但无论我单击 chm 文件中的哪个元素,我都会收到消息:
Navigation to the webpage was canceled.
What you can try:
Retype the address.
What's going on here?
这里发生了什么?
回答by Eric Leschinski
Summary
概括
Microsoft Security Updates 896358 & 840315 block display of CHM file contents when opened from a network drive (or a UNC path). This is Windows' attempt to stop attack vectors for viruses/malware from infecting your computer and has blocked out the .chm file that draw data over the "InfoTech" protocol, which this chm file uses.
Microsoft 安全更新 896358 和 840315 在从网络驱动器(或UNC 路径)打开时阻止显示 CHM 文件内容。这是 Windows 试图阻止病毒/恶意软件的攻击媒介感染您的计算机,并阻止了通过“InfoTech”协议绘制数据的 .chm 文件,该 chm 文件使用该协议。
Microsoft's summary of the problem: http://support.microsoft.com/kb/896054
微软的问题总结:http: //support.microsoft.com/kb/896054
Solutions
解决方案
If you are using Windows Server 2008, Windows 7, windows has created a quick fix. Right click the chm file, and you will get the "yourfile.chm Properties" dialog box, at the bottom, a button called "Unblock" appears. Click Unblock and press OK,and try to open the chm file again, it works correctly. This option is not available for earlier versions of Windows before WindowsXP (SP3).
Solve the problem by moving your chm file OFF the network drive. You may be unaware you are using a network drive, double check now: Right click your .chm file, click properties and look at the "location" field. If it starts with two backslashes like this:
\\epicserver\blah\
, then you are using a networked drive. So to fix it, Copy the chm file, and paste it into a local drive, like C:\ or E:.Then try to reopen the chm file, windows does not freak out.Last resort, if you can't copy/move the file off the networked drive. If you must open it where it sits, and you are using a lesser version of windows like XP, Vista, ME or other, you will have to manually tell Windows not to freak out over this .chm file. HHReg (HTML Help Registration Utility)Utility Automates this Task.Basically you download the HHReg utility, load your .chm file, press OK, and it will create the necessary registry keys to tell Windows not to block it. For more info: http://www.winhelponline.com/blog/fix-cannot-view-chm-files-network-xp-2003-vista/
如果您使用的是 Windows Server 2008、Windows 7,Windows 已经创建了一个快速修复程序。 右击chm文件,会出现“yourfile.chm属性”对话框,底部会出现一个叫“Unblock”的按钮。单击“取消阻止”并按“确定”,然后再次尝试打开 chm 文件,它可以正常工作。此选项不适用于 WindowsXP (SP3) 之前的早期 Windows 版本。
通过将您的 chm 文件移出网络驱动器来解决问题。您可能不知道您正在使用网络驱动器,现在请仔细检查:右键单击您的 .chm 文件,单击属性并查看“位置”字段。如果它以两个这样的反斜杠开头:
\\epicserver\blah\
,那么您使用的是网络驱动器。 因此,要修复它,请复制 chm 文件,然后将其粘贴到本地驱动器中,例如 C:\ 或 E:。然后尝试重新打开 chm 文件,windows 不会吓坏。最后的手段,如果你不能从网络驱动器复制/移动文件。如果您必须在它所在的位置打开它,并且您使用的是较低版本的 Windows,如 XP、Vista、ME 或其他版本,则您必须手动告诉 Windows 不要为这个 .chm 文件感到害怕。 HHReg(HTML 帮助注册实用程序)实用程序自动执行此任务。基本上,您下载 HHReg 实用程序,加载您的 .chm 文件,按 OK,它将创建必要的注册表项以告诉 Windows 不要阻止它。更多信息:http: //www.winhelponline.com/blog/fix-cannot-view-chm-files-network-xp-2003-vista/
Windows 8 or 10? --> Upgrade to Windows XP.
Windows 8 还是 10?--> 升级到 Windows XP。
回答by colemik
"unblocking" the file fixes the problem. Screenshot:
“解锁”文件可以解决问题。截屏:
回答by Hammond22
Win 8 x64:
赢 8 x64:
just move it to another folder or rename your folder (in my case: my folder was "c#"). avoid to use symbol on folder name. name it with letter.
只需将其移动到另一个文件夹或重命名您的文件夹(在我的情况下:我的文件夹是“c#”)。避免在文件夹名称上使用符号。用字母命名。
done.
完毕。
回答by Marco van de Voort
In addition to Eric Leschinski's answer, and because this is stackoverflow, a programmatical solution:
除了 Eric Leschinski 的回答,并且因为这是 stackoverflow,所以是一个程序化的解决方案:
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!)
Windows 使用隐藏文件分支将内容标记为“已下载”。截断这些会取消阻止文件。用于 CHM 的流的名称是“Zone.Identifier”。可以通过在打开文件时附加 :streamname 来访问流。(第一次保持备份,以防你的 RTL 搞砸了!)
In Delphi it would look like this:
在 Delphi 中,它看起来像这样:
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.
有人告诉我,在非分叉文件系统(如 FAT32)上有隐藏文件,但我还没有深入了解。
P.s. Delphi's DeleteFile() should also recognize forks.
Ps Delphi 的 DeleteFile() 也应该识别叉。
回答by GetFree
The definitive solution is to allow the InfoTech protocol to work in the intranet zone.
最终的解决方案是允许 InfoTech 协议在 Intranet 区域中工作。
Add the following value to the registry and the problem should be solved:
将以下值添加到注册表中,问题应该可以解决:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp.x\ItssRestrictions]
"MaxAllowedZone"=dword:00000001
More info here: http://support.microsoft.com/kb/896054
回答by LoveToCode
Go to Start
转到开始
Type regsvr32 hhctrl.ocx
类型 regsvr32 hhctrl.ocx
You should get a success message like:
您应该会收到一条成功消息,例如:
" DllRegisterServer in hhctrl.ocx succeeded "
“ hhctrl.ocx 中的 DllRegisterServer 成功”
Now try to open your CHM file again.
现在尝试再次打开您的 CHM 文件。
回答by tsenapathy
回答by Peter
I fixed this programmatically in my software, using C++ Builder.
我在我的软件中使用 C++ Builder 以编程方式修复了这个问题。
Before I assign the CHM help file, Application->HelpFile = HelpFileName
, I check to see if it contains the "Zone.Identifier" stream, and when it does, I simply remove it.
在分配 CHM 帮助文件之前Application->HelpFile = HelpFileName
,我会检查它是否包含“Zone.Identifier”流,当它包含时,我只需将其删除。
String ZIStream(HelpFileName + ":Zone.Identifier") ;
if (FileExists(ZIStream))
{ DeleteFile(ZIStream) ; }
回答by Hymantrader
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.
显然有不同级别的身份验证。我读过的大多数文章都告诉您将 MaxAllowedZone 设置为“1”,这意味着允许本地计算机区域和 Intranet 区域,但“4”允许访问“所有”区域。
For more info, read this article: https://support.microsoft.com/en-us/kb/892675
有关详细信息,请阅读本文: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.x]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp.x\ItssRestrictions]
"MaxAllowedZone"=dword:00000004
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp.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!
作为附加说明,奇怪的是需要“UrlAllowList”键才能在另一台 PC 上而不是我的测试 PC 上工作。它可能根本不需要,但是当我添加它时,它解决了问题。用户可能没有关闭原始文件或类似的东西。所以只是一个考虑。我建议至少尝试并测试它,然后根据需要添加。确认后,您可以根据需要进行部署。祝你好运!
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.
编辑:PS 另一种有效的方法是使用 mklink /d(Windows 7 或更高版本中的符号链接)将路径映射到本地网络,但映射网络驱动器号(Z:用于测试)不起作用。只是深思熟虑,我不必“取消阻止”任何文件。此外,公认的“解决方案”并没有为我解决这个问题。