Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to "Open in New Window" using WebBrowser control?

When you use the WebBrowser control in .NET you can "embed" an instance of IE in your application, essentially making your own IE-based Web Browser.

Does anyone know how to make any new windows created (like when the user selects "Open in New Window" from the context menu) open up in another Window of Your Web Browser Application, instead of the computers default browser??

like image 216
Chris Pietschmann Avatar asked Sep 22 '08 23:09

Chris Pietschmann


2 Answers

Maybe the Source Code from this CodeProject article can help:

Extended .NET 2.0 WebBrowser Control

like image 137
ManojN Avatar answered Sep 28 '22 03:09

ManojN


I did this a long time ago in VB.

From what I remember, when a NewWindow2 event was fired by the control, we would cancel the original request and open a separate VB form that contained another instance of the WebBrowser control pointed at the requested URL.

I did a quick google search and it seems like maybe this event isn't as easy to access in .Net. Take a look here for a possible solution.

like image 26
JKueck Avatar answered Sep 28 '22 01:09

JKueck