70046

IWebBrowser2 issues - how to open documents in new windows?

Question:

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

Answer1:

Have a look at the following article:

<a href="http://msdn.microsoft.com/en-us/library/aa770041.aspx" rel="nofollow">WebBrowser Customization</a>

Answer2:

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 <a href="https://stackoverflow.com/questions/2925279/iwebbrowser2-how-to-force-links-to-open-in-new-window/3066267#3066267" rel="nofollow">this question</a>.

Recommend

  • Weighted round robin dns between 2 Cloudfront distributions
  • Microsoft Chart Controls for Microsoft .NET Framework 4.0
  • Python Paramiko send CTRL+C to an ssh shell
  • Is mp4 stream able with ffserver?
  • R h2o.glm - issue with max_active_predictors
  • Entity Framework unable to delete database, database in use
  • Python/Javascript: WYSIWYG html editor - Handle large documents fast and/or design theory
  • Vuejs: Lifecycle hooks of child routerview components using keep alive
  • IE6 changes DOCTYPE to a bad one
  • IE10 strips out hashtag from the URL
  • Doctrine/Symfony entity generator and generating entity from one table
  • How can I run DataNucleus Bytecode Enhancer from SBT?
  • Why am I getting a “405 Method not allowed” error on “Put” operations through a WCF Resful service?
  • quiver not drawing arrows just lots of blue, matlab
  • AppleScript : find open tab in safari by name and open it
  • Default parameter as generic type
  • How do I display a dialog that asks the user multi-choice questıon using tkInter?
  • Ajax Upload File: $_FILES is empty but files exists in request header
  • ListItem.Attributes.Add not working
  • Bypass multiple inheritance in Java
  • wxPython: displaying multiple widgets in same frame
  • Alert pop up with LWUIT
  • Disabling Alt-F4 on a Win Forms NotifyIcon
  • Nant, Vault & Windows Integrated Authentication
  • Deleting and Updating values from a cusrsor adapter
  • Bug in WPF DataGrid
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • Window Size for Mac application
  • Can I make an Android app that runs a web view in Chrome 39?
  • jQuery tmpl and DataLink beta
  • How can I estimate amount of memory left with calling System.gc()?
  • php design question - will a Helper help here?
  • Traverse Array and Display in markup
  • AngularJs get employee from factory
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Qt: Run a script BEFORE make
  • LevelDB C iterator
  • Linking SubReports Without LinkChild/LinkMaster
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How do I use LINQ to get all the Items that have a particular SubItem?