Feroz
Feroz

Reputation: 351

Open a link in webBrowser control in external browser?

I want the links in my Webbrowser control to open in the default browser and not in the Windows control.

The exact same problem was tackled in the below link and I followed the same solution of intercepting the navigating event and canceling it.

How to open a link in webBrowser control in external browser?

But when I implement the solution, it works well when Chrome is the default browser. When IE (Ver 10) is the default browser, clicking the link opens the URL in the same webbrowser control. Any ideas?

Upvotes: 1

Views: 1880

Answers (1)

blitz_jones
blitz_jones

Reputation: 1078

Process.Start "Starts (or reuses) the process resource that is specified by the StartInfo property of this Process component and associates it with the component."

I suspect that since the WebBrowser control is actually a stripped down IE browser, using Process.Start reuses the WebBrowser control rather than launching a new instance of iexplore.exe.

You might need to have your code check the registry to see what the user's default browser is (Windows Registry key for "check whether IE is the default browser"?). If you find that the default browser is set to IE, then change the Process.Start method to explicitly launch iexplore.exe

Process.Start("iexplore.exe",e.Url.ToString());

Upvotes: 1

Related Questions