IWebBrowser2问题-如何在新窗口中打开文档?
我将 IWebBrowser2 ctrl 嵌入到我自己的对话框中。我想简单地 从我的网址显示其中的促销横幅。如何禁用所有弹出窗口 控件中的菜单项并强制其在新窗口中打开链接 (目前,当我单击横幅中的链接时,它正在被打开 在同一控制范围内)。 问候 多米尼克
I have IWebBrowser2 ctrl embedded into my own dialog. I want to simply
display a promo banner within it from my url. How to disable all popup
menu items from the control and force it to open links in new window
(currently when I click on link in the banner, it is being opened
within the same control).
Regards
Dominik
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请查看以下文章:
Web 浏览器自定义
Have a look at the following article:
WebBrowser Customization
我不知道是否有更方便的方法来执行此操作 - 但您始终可以拦截
BeforeExplorerNavigate2()
,将输出参数 cancel 设置为 true,然后从那里执行新的使用不同的目标框架名称 Navigate()
或打开一个新窗口。正如 Rob 指出的那样,过滤掉源自脚本的导航事件可能会出现问题,请参阅 这个问题。
I don't know if there is a more convenient way of doing this - but you could always intercept
BeforeExplorerNavigate2()
, set the out-parameter cancel to true and from there either do a newNavigate()
with a different target frame name or open a new window.As Rob pointed out, there might be problem with filtering out navigate events originating from scripts, see this question.