IWebBrowser2 issues - how to open documents in new windows?

别等时光非礼了梦想. 提交于 2019-12-08 08:06:08

问题


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


回答1:


Have a look at the following article:

WebBrowser Customization




回答2:


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 new Navigate() 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.



来源:https://stackoverflow.com/questions/1459865/iwebbrowser2-issues-how-to-open-documents-in-new-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!