I have a WPF app with the browser control dropped onto a tab. All works well until the website being displayed wants to open a link in a new window, this then breaks out of my app and opens a browser window. How can I open all links within the browser control inside my app?
Found the below code and gave it a try but no joy, anyone got a simple solution?
dynamic browser = sender;
dynamic activeElement = browser.Document.activeElement;
var link = activeElement.ToString();
// this is new Window,if you want open in current page,only change the browser.Source and Cancel the event
WebBrowser_Sourcing_Netcomponents_Enquiry.Source = new Uri(link);
catch (Exception ex)
e.Cancel = true;