I'm hosting YouTube Embedded Player in C# WebBrowser control. When I click button "Watch on YouTube" IE opens. Is there any way to open the link in default web browser, for instance, Chrome?
Asked
Active
Viewed 765 times
1 Answers
1
Like this for example:
private void browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{
System.Diagnostics.Process.Start(e.Url.ToString());
e.Cancel = true;
}
Explanation: change the navigating handler to process the URL and fire the link in the diagnostics (which will open the URL in the user’s default browser).

SomeoneS
- 1,207
- 2
- 19
- 34
-
Unfortunately when pressing on "Watch on YouTube" the event does not raised – Sergey Jul 27 '12 at 15:15
-
1I do not think this code will work since Navigating event is called when the current document is changed. You'll need to use this code to intercept the window opening and open it with the default browser: http://stackoverflow.com/questions/175836/system-windows-forms-webbrowser-open-links-in-same-window-or-new-window-with-sam – Fr33dan Jul 27 '12 at 15:16