问题
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