简体   繁体   English

MFC CHtmlView - 抑制混合内容警告?

[英]MFC CHtmlView - suppress mixed content warnings?

This is MFC and CHtmlView but it probably applies to all IE web control use. 这是MFC和CHtmlView,但它可能适用于所有IE Web控件使用。

When the web control is navigating to a page on some sites we are getting the HTTP / HTTPS mixed content warning popup. 当Web控件导航到某些站点上的页面时,我们将获得HTTP / HTTPS混合内容警告弹出窗口。

Is there any flag, command, or EXE specific registry key that can be set while our program is running that will disable the warning? 是否有任何标志,命令或EXE特定的注册表项可以在我们的程序运行时设置,将禁用警告? Even better, can we choose the "yes" or "no" response? 更好的是,我们可以选择“是”还是“否”回复?

We don't control the website so "fix the web page" is not an option. 我们不控制网站,因此“修复网页”不是一种选择。 Our program is running on customer PCs so "go into IE settings" is also not a good solution. 我们的程序在客户PC上运行,因此“进入IE设置”也不是一个好的解决方案。

Implement a Custom Security Manager on the control site class used by the CHTMLView derived class to handle URLACTION_HTML_MIXED_CONTENT with a success code. 在CHTMLView派生类使用的控制站点类上实现自定义安全管理器 ,以使用成功代码处理URLACTION_HTML_MIXED_CONTENT The control site is MFC's implementation of the ActiveX client site, from which the webbrowser control used in CHTMLView queries host capabilities . 控制站点是MFC的ActiveX客户端站点的实现, CHTMLView中使用的webbrowser控件从该站点查询主机功能

If you use MFC 7.0 or higher, you need to replace the control site via an overriden CreateControlSite function . 如果使用MFC 7.0或更高版本,则需要通过重写CreateControlSite函数替换控制站点。 In MFC 6.0 you can only replace the control container globally by calling AfxEnableControlContainer with your own COccManager that overrides the CreateSite method. 在MFC 6.0中,您只能通过使用覆盖CreateSite方法的自己的COccManager 调用AfxEnableControlContainer来全局替换控件容器。

After replacing the control site, add IServiceProvider and the security manager interfaces (, IInternetSecurityManager, optionally IInternetSecurityManagerEx and IInternetSecurityManagerEx2 ) via BEGIN_INTERFACE_PART/END_INTERFACE_PART macros on the control site class. 替换控制站点后,通过控制站点类上的BEGIN_INTERFACE_PART / END_INTERFACE_PART宏添加IServiceProvider和安全管理器接口(,IInternetSecurityManager,可选IInternetSecurityManagerEx和IInternetSecurityManagerEx2)。 If you are unfamiliar with the MFC macros, check TN038: MFC/OLE IUnknown Implementation . 如果您不熟悉MFC宏,请检查TN038:MFC / OLE IUnknown Implementation Your implementation should return INET_E_DEFAULT_ACTION unless when the method is ProcessUrlActionaction/ProcessUrlActionactionEx/ProcessUrlActionEx2 and the code is URLACTION_HTML_MIXED_CONTENT, then you need to return S_OK. 您的实现应该返回INET_E_DEFAULT_ACTION,除非该方法是ProcessUrlActionaction / ProcessUrlActionactionEx / ProcessUrlActionEx2并且代码是URLACTION_HTML_MIXED_CONTENT,那么您需要返回S_OK。 Fill pPolicy's address with URLPOLICY_ALLOW to silently allow mixed content, or URLPOLICY_DISALLOW to disallow. 使用URLPOLICY_ALLOW填充pPolicy的地址以静默允许混合内容,或禁用URLPOLICY_DISALLOW。 Use URLPOLICY_QUERY to ask the user when needed. 在需要时使用URLPOLICY_QUERY询问用户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM