Chris Pietschmann
Chris Pietschmann

Reputation: 29905

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??

Upvotes: 6

Views: 22412

Answers (4)

John Sims
John Sims

Reputation: 1

This site has the best solution I've found if you're using the .net version of the webbrowser control

http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/f497f8a5-dac8-48cb-9fce-7936c9389f09

Upvotes: 0

Chris Pietschmann
Chris Pietschmann

Reputation: 29905

There's a code sample here that contains code for adding the NewWindow2 event to the WebBrowser control. It sure would be nice if they added this event to the WebBrowser control itself.

http://zerosandtheone.com/media/p/277.aspx

Upvotes: 0

JKueck
JKueck

Reputation: 279

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.

Upvotes: 1

ManojN
ManojN

Reputation: 855

Maybe the Source Code from this CodeProject article can help:

Extended .NET 2.0 WebBrowser Control

Upvotes: 5

Related Questions