VB.Net webbrowser control coding question

Associate
Joined
29 Dec 2009
Posts
522
Hi all, wondering if anyone can help with this one.

I have a webbrowser biult in VB.Net which has two browsers. Webbrowser1 and Webbrowser 2.

When navigating to the default page required in Webbrowser 1, one of the HTML links that users will click defaults to open in a new popup window. I dont want this to appear in a new window. I want to force the popup to appear in Webbrowser2.

Does anyone have an idea of what code to use to force any popups generated to open in Webbrowser2? :)
 
Sorry, ill try to make it a little clearer.

On a standard form, I have two webBrowser controls. One on the left and one on the right. The first webBrowser1 control loads up its usual page specified within it. On this page, there is a link that users will click and this opens up in a new popup window.

Instead of the clicked link opening in a new popup, I want the popup to open in webBrowser2 instead. I need to tell webBrowser1 where to open the popup, in this case to webBrowser2.
 
I haven't used VB.Net in years, but in C# you might try adding a Navigating event handler to your first control, and checking and then assigning the Url (from the WebBrowserNavigatingEventArgs parameter) to your second webbrowser control.

You can also check the url so that only certain urls are permitted/redirected. You'll need to add e.Cancel = true, to your event handler to prevent the first webbrowser control from also going to the clicked url.


hth.
 
Back
Top Bottom